UISegmentControl/多段选择视图
2015-07-08 08:46
441 查看
UISegmentControl/多段选择视图
NSArray *array=[NSArray arrayWithObjects:@"First",@"Second",@"Third", nil];
1、分段选择控件
UISegmentedControl *sc=[[UISegmentedControl alloc] initWithItems:array];
[sc setFrame:CGRectMake(50, 200, 200, 50)];
2、设置控件颜色
sc.tintColor=[UIColor redColor];
3、默认选择起始位置
sc.selectedSegmentIndex=1;
4、自适应内容,(哪个宽加宽哪个框)
sc.apportionsSegmentWidthsByContent=YES;
5、改变内容
[sc setTitle:@"Thir d" forSegmentAtIndex:2];
6、添加事件
[sc addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
7、添加控件
[self.view addSubview:sc];
NSArray *array=[NSArray arrayWithObjects:@"First",@"Second",@"Third", nil];
1、分段选择控件
UISegmentedControl *sc=[[UISegmentedControl alloc] initWithItems:array];
[sc setFrame:CGRectMake(50, 200, 200, 50)];
2、设置控件颜色
sc.tintColor=[UIColor redColor];
3、默认选择起始位置
sc.selectedSegmentIndex=1;
4、自适应内容,(哪个宽加宽哪个框)
sc.apportionsSegmentWidthsByContent=YES;
5、改变内容
[sc setTitle:@"Thir d" forSegmentAtIndex:2];
6、添加事件
[sc addTarget:self action:@selector(valueChanged:) forControlEvents:UIControlEventValueChanged];
7、添加控件
[self.view addSubview:sc];
相关文章推荐
- EasyUI 树型菜单 异步加载树
- 黑马程序员——JAVA笔记——GUI
- druid 数据源密码加密配置
- Work around by " Due to heavy load, the latest workflow operation has been queued. "
- Work around by " Due to heavy load, the latest workflow operation has been queued. " 分类: Sharepoint 2015-07-08 00:19 3人阅读 评论(0) 收藏
- iOS-UITextField收起键盘和拓展
- 线程的学习(一)
- MySQL提示:The server quit without updating PID file
- UIViewController的生命周期及iOS程序执行顺序
- C#常用的集合类型(ArrayList类、Stack类、Queue类、Hashtable类、SortedList类)
- UIScrollView现实自动循环滚动
- SPOJ 375 Query on a tree(初学树链剖分)
- Foundation框架-05 NSNumber和NSValue
- Mac Error Create Android Project - “Errors running builder 'Android Resource Manager' on project”
- DicomIoException: Requested 132 bytes past end of fixed length stream.
- Dynamics CRM 2015 Update 1 系列(7): 消息事务 - ExecuteTransactionRequest
- UI_UIScrollView/UIpageControl
- Android view中的requestLayout和invalidate方法
- IOS UITextView 提交建议反馈
- DirectUI界面编程(零)简介