我想更改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)];
}
感謝