UIButton
2015-07-30 20:58
393 查看
//用button自己的便利构造器的方式来创建对象
UIButton *button= [UIButton
buttonWithType:UIButtonTypeSystem];
//指定button的位置和大小
button.frame=CGRectMake(100,
100, 150,
70);
//设置背景颜色
button.backgroundColor=[UIColor
cyanColor];
[self.window
addSubview:button];
//button不需要release
//给button设置标题
//通常状态
[button setTitle:@"确认"
forState:UIControlStateNormal];
//设置button的字体大小
//
button.titleLabel.font=[UIFont
systemFontOfSize:20];
// //设置圆角
button.layer.cornerRadius=10;
// //设置边框
button.layer.borderWidth=1;
//
// //点击方法,button最重要的部分
[button addTarget:self
action:@selector(click:)
forControlEvents:UIControlEventTouchUpInside];
UIButton *button= [UIButton
buttonWithType:UIButtonTypeSystem];
//指定button的位置和大小
button.frame=CGRectMake(100,
100, 150,
70);
//设置背景颜色
button.backgroundColor=[UIColor
cyanColor];
[self.window
addSubview:button];
//button不需要release
//给button设置标题
//通常状态
[button setTitle:@"确认"
forState:UIControlStateNormal];
//设置button的字体大小
//
button.titleLabel.font=[UIFont
systemFontOfSize:20];
// //设置圆角
button.layer.cornerRadius=10;
// //设置边框
button.layer.borderWidth=1;
//
// //点击方法,button最重要的部分
[button addTarget:self
action:@selector(click:)
forControlEvents:UIControlEventTouchUpInside];
相关文章推荐
- IOS--UI--LessonThread 线程
- UIView
- UIScrollView
- wfp数据类型转换--Uint16转二进制字符串
- UI01_UILabel(加粗,文字是否高亮,文字是否可变,文字是否自适应label宽度)
- Visual GDB 工程 使用ndk-build命令失败的解决方法
- Snail—UI学习之表视图TableView单行添加、删除和移动
- (easy)LeetCode 225.Implement Stack using Queues
- Snail—UI学习之表视图TableView初识
- Spark SQL and DataFrame Guide(1.4.1)——之Data Sources
- uiaotumator ui测试 快速调试
- (转载)音频队列服务编程指南(Audio Queue Services Programming Guide)(二)
- iOS UIViewController API解读
- ios UIView全部API解读
- iOS之UIViewController
- SGU 456 Annuity Payment Scheme
- buidroot使用浅谈
- POJ 3709 K-Anonymous Sequence (斜率优化DP)
- build path--use as source folder 应用
- UI01_UIView