@property (nonatomic,strong) UIButton * selectedButton;
NSArray * titleArr = @[@"试玩幸运奖",@"视频幸运奖"];
for (int i = 0; i<titleArr.count; i++) {
CGFloat width = infoView.width/2;
CGFloat height = 50;
CGFloat x = width * i;
CGFloat y = 0;
UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(x, y, width, height)];
[infoView addSubview:btn];
[btn setTitle:titleArr[i] forState:UIControlStateNormal];
[btn setTitleColor:RGB(153, 153, 153) forState:UIControlStateNormal];
[btn setTitleColor:RGB(247, 175, 19) forState:UIControlStateDisabled];
btn.titleLabel.font = [UIFont boldSystemFontOfSize:16];
[btn addTarget:self action:@selector(btnClick:) forControlEvents:UIControlEventTouchUpInside];
btn.tag = i;
if (i == 0) {
btn.enabled = NO;
self.selectedButton = btn;
}
}
-(void)btnClick:(UIButton *)btn{
// 修改按钮状态
self.selectedButton.enabled = YES;
btn.enabled = NO;
self.selectedButton = btn;
}