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];
UIButton属性与图片设置教程
本文详细介绍了如何使用UIButton在iOS应用中设置属性和添加图片,包括颜色、边角圆润、文字显示、背景色及按钮点击事件的实现。
2125

被折叠的 条评论
为什么被折叠?



