自定义后,文字位置歪了。。
用于自定义的代码:
+ (void)customiseSegmentControl {
UIImage *selectedImage = [[UIImage imageNamed:@"SegmentSelected.png"]
stretchableImageWithLeftCapWidth:5 topCapHeight:1];
UIImage *unselectedImage = [[UIImage imageNamed:@"SegmentUnselected.png"]
stretchableImageWithLeftCapWidth:5 topCapHeight:1];
[[UISegmentedControl appearance] setBackgroundImage:selectedImage forState:(UIControlStateSelected|UIControlStateHighlighted) barMetrics:UIBarMetricsDefault];
[[UISegmentedControl appearance] setBackgroundImage:unselectedImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
}