UISwitch 的具体使用方式
来源:互联网 发布:谭咏麟你知我知被禁 编辑:程序博客网 时间:2024/05/29 09:37
1.创建
UISwitch *RRPSwitch = [[UISwitch alloc] initWithFrame:CGRectMake(RRPWidth - 60, 10, 45, 20)];
2.设置属性
<1>开启时的颜色
RRPSwitch.onTintColor = [UIColor yellowColor];
<2>关闭时的颜色
RRPSwitch.tintColor = [UIColor brownColor];
<3>开启时的图片
RRPSwitch.onImage = [UIImage imageNamed:@"save"];
<4>关闭时的图片
RRPSwitch.offImage = [UIImage imageNamed:@"bookTicket"];
<5>圆形按钮颜色
RRPSwitch.thumbTintColor = [UIColor blackColor];
<6>设置开关状态和动画效果
[RRPSwitch setOn:NO animated:YES];
<7>添加开关方法
[RRPSwitch addTarget:self action:@selector(switchSlideYesOrNo:) forControlEvents:(UIControlEventValueChanged)];
<8>加到要放的控件上
[self.view addSubview:RRPSwitch];
开关的实现
- (void)switchSlideYesOrNo:(UISwitch *)sender { if (sender.isOn) { NSLog(@"打开了"); }else{ NSLog(@"关闭"); }}
0 0
- UISwitch 的具体使用方式
- UISwitch的使用
- UISwitch的详细使用
- UISwitch的使用
- UISwitch的使用
- UISwitch 的使用详解
- UISwitch的使用
- C#iphone UISwitch 的使用
- swift中UISwitch的使用
- swift中UISwitch的使用
- iOS开发之UISwitch控件的使用
- mono touch中UISwitch控件的使用
- Ios学习之uiswitch的使用
- UISwitch - 开关按钮 的使用详解
- IOS之UISwitch使用
- IOS的基本控件的使用-UISwitch控件
- vnc的具体使用
- Axis2的具体使用
- HDU 1.3.4 百步穿杨
- 针对Android Service不能隐式启动的问题
- LEETCODE 160
- HDU 1.3.5 Wooden Sticks
- Hive 表加载,导出和查询
- UISwitch 的具体使用方式
- C#操作ZIP的方法
- HDU 1.3.6 Rank
- 进程的同步与互斥
- select a method for export 选项
- 摇奖机-多线程
- HDU 1.3.8 Who's in the Middle
- android日记:mediaPlayer的使用
- 常用时间函数总结