给iOS开发新手送点福利,简述UISwitch的属性和用法
UISwitch属性
1. onTintColor
处于on时switch 的颜色
switchImage.onTintColor = [UIColor grayColor];
2.tintColor
处于off时switch 的颜色
switchImage.tintColor = [UIColor greenColor];
3.onImage
设置on 的图标
switchImage.onImage = [UIImage imageNamed:@"1.png"];
4. offImage
设置off的图标
switchImage.offImage = [UIImage imageNamed:@"4.png"];
5. on
设置switch的开关
swithImage.on = YES;
6.thumbTintColor
设置拇指颜色
swithImage.thumbTintColor = [UIColor
redColor];
效果:

7.增加事件响应机制
监听的是这个事件:UIControlEventValueChanged,值改变事件
[switchImage addTarget:self action:@selector(switchOn) forControlEvents:UIControlEventValueChanged];
给iOS开发新手送点福利,简述UISwitch的属性和用法的更多相关文章
- 给iOS开发新手送点福利,简述UIImagePickerController的属性和用法
1.+(BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType; // 检查指定源是否在设备上 ...
- 给iOS开发新手送点福利,简述UITableView的属性和用法
UITableView UITableView内置了两种样式:UITableViewStylePlain,UITableViewStyleGrouped <UITableViewDataSo ...
- 给iOS开发新手送点福利,简述UIView的属性和用法
UIView 1.alpha 设置视图的透明度.默认为1. // 完全透明 view.alpha = 0; // 不透明 view.alpha = 1; 2.clipsToBounds // 默认是N ...
- 给iOS开发新手送点福利,简述UITextField的属性和用法
UITextField属性 0. enablesReturnKeyAutomatically 默认为No,如果设置为Yes,文本框中没有输入任何字符的话,右下角的返回按钮是disabled的. ...
- 给iOS开发新手送点福利,简述UILabel的属性和用法
UILabel属性 1.text:设置标签显示文本. label.text = @"我是Label"; 2.attributedText:设置标签属性文本. NSString *t ...
- 给iOS开发新手送点福利,简述UIPikerView的属性和用法
1. numberOfComponents:返回UIPickerView当前的列数 NSInteger num = _pickerView.numberOfComponents; NSLog( @ ...
- 给iOS开发新手送点福利,简述UIScrollView的属性和用法
UIScrollView 1. contentOffset 默认CGPointZero,用来设置scrollView的滚动偏移量. // 设置scrollView的滚动偏移量 scrollView ...
- 给iOS开发新手送点福利,简述UIPageControl的属性和用法
UIPageControl 1. numberOfPages // 设置有多少页 默认为0 [pageControl setNumberOfPages:kImageCount]; 2. cur ...
- 给iOS开发新手送点福利,简述UISegment的属性和用法
UISegment属性 1.segmentedControlStyle 设置segment的显示样式. typedef NS_ENUM(NSInteger, UISegmentedControlSty ...
随机推荐
- linux yum安装lsof命令
[root@ITC-MCC ~]# yum install lsof[USM] permission denied^C[root@ITC-MCC ~]# [root@ITC-MCC ~]# [root ...
- day40 数据结构-算法(二)
什么是数据结构? 简单来说,数据结构就是设计数据以何种方式组织并存储在计算机中. 比如:列表.集合与字典等都是一种数据结构. N.Wirth: “程序=数据结构+算法” 列表 列表:在其他编程语言中称 ...
- JavaScript学习总结(二十二)——JavaScript屏蔽Backspace键
今天在IE浏览器下发现,当把使用readonly="readonly"属性将文本框设置成只读<input type="text" readonly=&qu ...
- hook 学习
一.hook 是什么? Hooks Overview 二.hook 的用法 三.hook 应用
- ViewPager实现引导页(添加导航点,判断是否第一次进入主界面)
1.引导页的4个界面布局,里面加载一张背景图片 插入到guide的界面布局中(这里不用fragment) guide_background_fragment1.xml <?xml version ...
- epoint:TreeView
Epoint.Web.UI.WebControls2X.EpointTreeNode 思路:就是使用递归 RootNodeText 根节点名称RootNodeUrl 根节点路径ShowRootNode ...
- Java——三大特性
body, table{font-family: 微软雅黑; font-size: 10pt} table{border-collapse: collapse; border: solid gray; ...
- 『转』Panda Antivirus Pro 2014 – 免费6个月
Panda Antivirus Pro 2014 为您的计算机提供了最简单的使用和最直观的保护.最近,Panda公司和 softonic公司合作推出免费半年版本活动地址:点此进入点击“Kostenlo ...
- L175 Endorestiform Nucleus: Scientist Just Discovered a New Part of the Human Brain
The newly named Endorestiform Nucleus sits in the inferior cerebellar小脑 peduncle, at the junction be ...
- mybatis单笔批量保存
在上一篇写了接口调用解析返回的xml,并赋值到实体.这一篇主要介绍,如何保存实体数据. 一,xml样例 <?xml version="1.0" encoding=" ...