//用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];