我想更改uisegment控件的字体颜色和字体大小。是可能的?更改UISegment控件的字体颜色和大小
,如果任何人有这样做的,任何一个有解决办法,请告诉我,或分享任何有用的链接
感谢。对于同一
- (void)insertSegmentWithImage:(UIImage *)image atIndex:(NSUInteger)segment animated:(BOOL)animated;
我想更改uisegment控件的字体颜色和字体大小。是可能的?更改UISegment控件的字体颜色和大小
,如果任何人有这样做的,任何一个有解决办法,请告诉我,或分享任何有用的链接
感谢。对于同一
- (void)insertSegmentWithImage:(UIImage *)image atIndex:(NSUInteger)segment animated:(BOOL)animated;
更好地利用图像由于一些其他的答案提到,您还可以使用setTitleTextAttributes:forState:
UIFont *font = [UIFont boldSystemFontOfSize:12.0f];
NSDictionary *attributes = [NSDictionary dictionaryWithObject:font
forKey:UITextAttributeFont];
[segmentedControl setTitleTextAttributes:attributes
forState:UIControlStateNormal];
入住这
NSArray *ary=[sgmntControl subviews];
NSInteger intCount=0;
for (id seg in ary)
for (id label in [seg subviews])
if ([label isKindOfClass:[UILabel class]])
{
if(intCount==1)
{
[label setTextColor:[UIColor blackColor]];
[label setShadowColor:[UIColor whiteColor]];
}
else {
[label setTextColor:[UIColor whiteColor]];
[label setShadowColor:[UIColor blackColor]];
}
[label setFont:[UIFont boldSystemFontOfSize:16]];
[label setShadowOffset:CGSizeMake(0,1)];
}
感谢