xib支持图形化操作,提供了几乎所有的控件可供选择,只需拖动到相应的位置即可,但是控件的后台代码仍然需要手动编写,一定程度上加速了前台的开发.

xib快速开发程序,手写代码速度比较慢

xib适合做静态页面,代码适合动态复杂的页面

xib不适合svn/git代码管理,代码比较适合

xib不适合后期维护,代码适合长期维护

如果xib文件名与类所在的文件夹名相同,可以直接使用init方法,自动查找同名的xib资源文件

UISwitch 开关

设置显示时的开关状态

[mySwitch setOn:YES];

设置开状态的颜色

mySwitch.onTintColor=[UIColor redColor];

设置关状态的颜色

mySwitch.tintColor=[UIColor redColor];

开关中间的按钮的颜色

mySwitch.thumbTintColor=[UIColor yellowColor];

UIActivityIndicatorView 活动指示器(加载东西时出现的状态显示控件)

默认为YES,YES表示隐藏

activityIndicator.hidden=NO;

UISlider 滑动条

设置滑动条最小值

mySlider.minimumValue=1;

设置进度条的最大值

mySlider.maximumValue=10;

设置进度条按钮的背景颜色

mySlider.thumbTintColor=[UiColor redColor];

左侧滑动条的颜色

mySlider.minimumTrackTintColor=[UIColor blueColor];

右侧滑动条的颜色

mySlider.maximumTrackTintColor=[UIColor yellowColor];

UIStepper 增减按钮

最小减到的值

stepper.minimumValue=0;

最大增加到的值

stepper.maximumValue=1;

每次改变的值,每次加减0.2

stepper.stepValue=0.2;

UIProgressView 进度条

设置进度的位置为0

progressView.progress=0;

完成进度的进度条颜色

progressView.trackTintColor=[UIColor redColor];

未完成的进度条颜色

progressView.progressTintColor=[UIColor greenColor];

UIDatePicker 日历

显示日期模式(还有钟点模式,日期加钟点模式)

picker.datePickerModeDate=UIDatePickerModeDate;

NSDate 日期

设置最大日期

NSDate nowDate=[NSDate date];

NSDate maxDate=[nowDate dateByAddingTimeInterval:3600*24*30];

picker.maximumDate=maxDate;

UIAlertView对话框

设置弹出对话框的内容

UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:@"提示" message:@"你确定要删除吗?" delegate:nil cancelButtonTitle:@"否" otherButtonTitles:@"是", nil];

设置抬出对话框的模式

alertView.alertViewStyle=UIAlertViewStyleLoginAndPasswordInput;

设置对话框显示出来,若未设置,将不会显示

[alertView show];

UIActionSheet从手机下方推出的操作选择列表

设置显示推出框,不设置将不会推出

UIActionSheet *sheet=[[UIActionSheet alloc] initWithTitle:@"操作" delegate:self cancelButtonTitle:@"保存到手机" destructiveButtonTitle:@"发送给好友" otherButtonTitles:@"其他共享", nil];设置推出框的内容

sheet.actionSheetStyle=UIActionSheetStyleAutomatic;推出框的模式

[sheet showInView:self.view];

NSTimer 计时器

设置计时器每隔一秒触发一次事件,调用本类中的方法并重复调用

_timer=[NSTimer scheduledTimerWithTimeInterval:1 target: self selector: @selector(updateLabel:) userInfo:nil repeats:YES];

NSTimer *timer;

//暂停计时器(在很久以后再开始)

[timer setFireDate:[NSDate distantFuture]];

//重启计时器(从当前按时刻开始)

[timer setFireDate:[NSDate date]];    //或者(从过去时刻开始)[timer setFireDate:[NSDate distantPast]];

//毁掉计时器

if([timer isValid])

{

[timer invalidate];

}

最新文章

  1. gulp教程之gulp-rev-append
  2. centos vim配置高亮语法和格式化粘贴
  3. objective c, category 和 protocol 中添加property
  4. echarts -01 入门
  5. POJ 2689
  6. c语言数组的初始化
  7. powerdesigner简单使用
  8. WM_SYSCOMMAND包括很多功能,比如:拖动左边框、拖动标题栏、滚动条滚动、点击最小化、双击标题栏——Delphi 通过事件代替了大部分常用的消息,所以Delphi 简单、易用、高效
  9. 配置RMAN备份环境
  10. ASP.NET MVC 重写RazorViewEngine实现多主题切换
  11. Java代码输出是“father”还是“child”(一)
  12. (三)设置mysql允许外部IP连接的解决方法及遇到的坑说明
  13. Unknown column 'user_uid' in 'field list' sql错误解决过程
  14. border_mode
  15. Mac下开启与关闭端口转发的脚本配置方法
  16. centos HA高可用集群 heartbeat搭建 heartbeat测试 主上停止heartbeat服务 测试脑裂 两边都禁用ping仲裁 第三十二节课
  17. java线上应用故障排查之二:高内存占用【转】
  18. zabbix触发的多条件判断表达式
  19. jquery slideDown效果
  20. 【webservice】Two classes have the same XML type name(转)

热门文章

  1. windows2008,命令行远程登录
  2. 源代码分析Fragmentd的BackStack管理过程
  3. 基于docker的webrtc开发环境
  4. Windows下使用python
  5. 【转】Monkey测试3——Monkey测试结果分析
  6. .net 连接Redis
  7. 百度网盘不能绑定QQ
  8. Failed to load the JNI shared library jvm.dl
  9. 带参数的main函数
  10. maven仓库添加本地jar