还是先看一下我的另一篇博文:《UIControl IOS控件编程》
一、创建
两种方法:
1. 常规的 initWithFrame
UIButton *btn1 = [[UIButton alloc]initWithFrame:CGRectMake(10, 10, 80, 44)];
对代码创建View(UIControl继承自UIView,所以也是view)不甚了解的请参看:
《有关View的几个基础知识点》
2. UIButton 的一个类方法(也可以说是静态方法)buttonWithType
UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
风格有如下
typedef enum {
UIButtonTypeCustom = 0, // no button type ......
阅读全文