博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Button

Posted on 2013-08-02 14:19  晨时雨  阅读(236)  评论(0)    收藏  举报

UIButton *BeginButton1 = [UIButtonbuttonWithType:UIButtonTypeRoundedRect];

BeginButton1.frame = CGRectMake(10, 40, ((self.tableView.frame.size.width/2)-10), 30);

[BeginButton1 setTitle:@"    -  -  "forState:UIControlStateNormal];

[BeginButton1 addTarget:selfaction:@selector(BeginButton1Pressed:) forControlEvents:UIControlEventTouchUpInside];

 

错误写法:

UIButton *paymentButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 45, 300, 41)];

然后又创建了一个,新的Button会覆盖前一个,所以设置要重构框架:

paymentButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];