可能是重复的问题:
如何更改UISegmentedControl的字体颜色
是否可以保持UISegmentedControl
的segment
中所选文本和未选文本的不同字体颜色?任何帮助将不胜感激。
可能是重复的问题:
如何更改UISegmentedControl的字体颜色
是否可以保持UISegmentedControl
的segment
中所选文本和未选文本的不同字体颜色?任何帮助将不胜感激。
// Instantiate as usual
NSArray *items = [NSArray arrayWithObjects:@"first", @"second", [UIImage imageNamed:@"image.png"], nil];
MCSegmentedControl *segmentedControl = [[MCSegmentedControl alloc] initWithItems:items];
// set frame, add to view, set target and action for value change as usual
segmentedControl.frame = CGRectMake(10.0f, 10.0f, 300.0f, 44.0f);
[self.view addSubview:segmentedControl];
[segmentedControl addTarget:self action:@selector(segmentedControlDidChange:) forControlEvents:UIControlEventValueChanged];
// Set a tint color
segmentedControl.tintColor = [UIColor orangeColor];
// Customize font and items color
segmentedControl.selectedItemColor = [UIColor yellowColor];
segmentedControl.unselectedItemColor = [UIColor darkGrayColor];
- (void)setWidth:(CGFloat)width forSegmentAtIndex:(NSUInteger)segment;
- (void)setContentOffset:(CGSize)offset forSegmentAtIndex:(NSUInteger)segment