夜晚本来像用代码写一个Button按钮,但是出现问题:开始是这样创建的
- (void)viewDidLoad
{
[super viewDidLoad];
//初始化Button的位置大小
UIButton *writeButton = [[UIButton alloc] initWithFrame:CGRectMake(100.0f, 100.0f, 50.0f, 30.0f)];
//设置BUtton的形状,此处为圆角按钮
writeButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//设置Button名字,和他的状态,此处是一般的状态
[writeButton setTitle:@"代码按钮" forState:UIControlStateNormal];
//Button背景色
writeButton.backgroundColor = [UIColor redColor];
//Button的触摸事件
[writeButton addTarget:self action:@selector(buttonClicked) forControlEvents:UIControlEventTouchUpInside];
//把Button添