UIButton相关代码如下:
UIButton *fistBt = [[UIButton alloc] initWithFrame:CGRectMake(10, 130, SCREEN_WIDTH/2 - 25, 40)];
[fistBt.layer setCornerRadius:5];
[fistBt setTitle:@"取消" forState:0];
[fistBt setTintColor:RGB(255, 106, 34)];
[fistBt setBackgroundColor:[UIColor lightGrayColor]];
[fistBt addTarget:self action:@selector(fistClick) forControlEvents:UIControlEventTouchUpInside];
给button添加图片
//设置button填充图片,不会拉伸控件
[button1 setImage:[UIImage imageNamed:@"btng.png"] forState:UIControlStateNormal];