UIButton 的最基础用法.docxVIP

  • 4
  • 0
  • 约2.44千字
  • 约 5页
  • 2016-08-23 发布于河南
  • 举报
UIButton 的最基础用法

UIButton 的最基础用法UIButton(1) 创建显示一个Button //演示UI中按钮类UIButton使用 //需求: 想要在界面上显示一个按钮 //解决:使用UIButton按钮类 //1创建按钮,一般需要指定按钮的风格 //系统样式的按钮: UIButtonTypeSystem //如果创建带图片的: 一般选用UIButtonTypeCustom //圆角矩形: ios7不再使用 UIButtonTypeRoundedRect //UIButtonTypeInfoDark 多显示一个圆圈和i //UIButtonTypeContactAdd 多显示一个圆圈和+号 UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; //设置按钮位置和大小 button.frame = CGRectMake(100, 100, 100, 30); //设置按钮显示的文本 //按钮随着点击有各种不同的状态 //设置显示的文本时候设置不同状态下的文本 //细节: 按钮常用状态 正常, 高亮, 禁止 [button setTitle:@点我啊 forState:UIControlStateNormal]; [button setTitle:@被点了 forState:UIControlStateHighli

文档评论(0)

1亿VIP精品文档

相关文档