iOS UISegmentedControl的基本使用方法
2016-10-23 00:00
381 查看
摘要: iOS UISegmentedControl
1.控件的初始化
2.设置当前索引所在位置
3.设置控件颜色
4.修改指定位置的内容
6.设置点击后恢复原样
7.设置点击事件
1.控件的初始化
UISegmentedControl*sc=[[UISegmentedControl alloc]initWithItems:@[@"1",@"2",@"3"]]; //initWithItems:(NSArray*)arr sc.frame=CGRectMake(50,50, 100, 50);//设置位置
2.设置当前索引所在位置
sc.selectedSegmentIndex=1;
3.设置控件颜色
sc.tintColor=[UIColor blueColor];
4.修改指定位置的内容
[sc setTitle:@"100" forSegmentAtIndex:1];
6.设置点击后恢复原样
//默认为点击后保留点击效果,设置为yes后点击后恢复成原来的样子 sc.momentary=YES;
7.设置点击事件
[sc addTarget:self action:@selector(click:) forControlEvents:UIControlEventValueChanged];
相关文章推荐
- iOS - UISegmentedControl使用方法
- IOS学习笔记(七)之UISegmentedControl分段控件的基本概念和使用方法
- IOS学习笔记(七)之UISegmentedControl分段控件的基本概念和使用方法
- iOS UISwitch UISegmentedControl UITextField使用方法
- iOS UISegmentedControl 的简单使用
- iOS 非ARC基本内存管理系列 5-autorelease方法使用总结
- UISegmentedControl的各种属性与方法的使用,详细!!!
- iOS 分度那控制UISegmentedControl添加到导航栏上的使用方法
- iOS--UISegmentedControl的使用方法详细
- iOS—UISegmentedControl的详细使用
- iOS中正则表达式的基本使用方法
- iOS开发OC基础:OC集合NSSet、NSMutableSet以及NSCountedSet的基本方法的使用
- iOS开发UITableView基本使用方法总结
- IOS学习笔记(九)之UIAlertView(警告视图)和UIActionSheet(操作表视图)基本概念和使用方法
- iOS中正则表达式的基本使用方法
- ios菜鸟之路:uiscrollview和pagecontrol的使用方法
- IOS学习笔记(八)之UIActivityIndicatorView(活动指示器视图)的基本概念和使用方法
- IOS学习笔记(十)之UIImageView图片视图的基本概念和使用方法
- IOS使用视图控制器和视图(五)使用 UISegmentedControl 做简单选项分组
- iOS--UIPageControl的使用方法详细