iOS-UI-UISegmentedControl-分段控制器

2016-01-18 19:18:00


self.seg = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"界面1", @"界面2", @"界面3", nil]];

self.seg.frame = CGRectMake(100, 100, 200, 30);
// 起始选中状态
self.seg.selectedSegmentIndex = 0;
// 注意触发方式
[self.seg addTarget:self action:@selector(segAction:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:self.seg];
[self.seg release];

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »