【发布时间】:2012-08-14 23:44:24
【问题描述】:
自定义后,文字位置歪了..
用于自定义的代码:
+ (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];
}
【问题讨论】:
-
谢谢你们的回答。。解决了这个问题。,问题在于 UIImage 的 UIEdgeInsets 属性
标签: objective-c ios ios5 custom-controls uisegmentedcontrol