UIButton及其方法
来源:互联网 发布:音频频谱分析软件 编辑:程序博客网 时间:2024/06/05 18:20
// UIButton
// 点击按钮视图
// 1.Button用便利构造器创建时,不需要释放// 2.currentTitle 当前的标题// 3.current 当前的// 1.创建一个Button方式同UIView 1 ~ 4// 2.添加边框 弧度button.layer.borderWidth = 1;button.layer.cornerRadius = 10;// 3.添加一个标题[button setTitle:@"确认" forState:UIControlStateNormal];// 4.修改字体大小button.titleLabel.font = [UIFont systemFontOfSize:25];// 5.修改颜色[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];// 6.放置一个图片作为buttonUIButton *bu = [UIButton buttonWithType:UIButtonTypeSystem];[bu setBackgroundImage:[UIImage imageNamed:@"文件名"] forState:UIControlStateNormal];// 7.给button添加一个事件 (用触发button点击 去调用一个方法)[button addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];// 实现一个点击后 使button改变字符的方法- (void)click:(UIButton *)button { // 如果button 当前的标题是确认 if ([button.currentTitle isEqualToString:@"确认"]) { // 把button的标题设为取消 在控件正常状态时 [button setTitle:@"取消" forState:UIControlStateNormal]; // 否则 } else { // 把button的标题设为确认 在控件正常状态时 [button setTitle:@"确认" forState:UIControlStateNormal]; }}
0 0
- UIButton及其方法
- UIButton常用方法
- 禁用UIButton的方法
- UIBUTTON 拉伸方法
- UIButton 触发两个方法
- 禁用UIButton的方法
- UIButton 方法以及属性
- UIButton 的 常用方法
- UIButton系统方法详解
- iOS. UIButton 常用方法
- 自定义UIButton一般方法
- 对比:UIButton创建方法
- UIButton的方法
- UIButton 的一些设置方法
- UIButton图片Lable共存方法
- UIButton常用方法和属性
- UIButton重复点击几个方法
- UIButton的sizeToFit方法无效
- java.lang.IllegalArgumentException: Service Intent must be explicit异常说明
- 函数
- 堆排序
- AutoLayout框架Masonry使用心得
- 剑指offer学习读书笔记--二维数组中的查找
- UIButton及其方法
- 测试给andorid编写驱动
- utf8_general_ci、utf8_unicode_ci和utf8_bin的区别
- WCF 简易教程 IIS配置(一)
- BST:二叉排序树算法
- C语言——逗号表达式
- 剑指Offer-20-顺时针打印矩阵
- Apache与Tomcat的联系和区别
- 四维矩阵、四维数组