用处:多分段选择控件,选中某个分段会触发值改变事件。
-(void)viewDidLoad
{
[super viewDidLoad];
NSArray* items = @[@"a",@"b",@"c"];
self.seg = [[UISegmentedControl alloc]initWithItems:items];
CGRect frame = CGRectMake(20,20,180,50);
self.seg.frame = frame;
//设置索引的标题
[self.seg setTitle:@"two" forSegmentAtIndex:1];
//设置默认选择器索引
self.seg.selectedSegmentIndex = 1;
//设置底色
self.seg.tintColor = [UIColor redColor];
//设置样式
self.seg.segmentedControlStyle = UISegmentedControlStyleBar;
}
UISegmentedControl控件,布布扣,bubuko.com
原文:http://www.cnblogs.com/AngryCooder/p/3895279.html