//_normalarray = @[@"like",@"More",@"Reply",@"share"];
_normalarray = [NSArray arrayWithObjects:@"脑炎后遗症",@"More",@"Reply",@"share", nil];
_selectedarray = @[@"矮小症",@"矮小症",@"矮小症",@"矮小症"];
for (int i = 0; i < 4; i++) {
_btntwo = [[UIButton alloc]initWithFrame:CGRectMake( i *(80 +2), 100, 120, 120)];
_btntwo.backgroundColor = [UIColor redColor];
[_btntwo addTarget:self action:@selector(clickbtntwo:) forControlEvents:UIControlEventTouchUpInside];
[_btntwo setBackgroundImage:[UIImage imageNamed:_normalarray[i]] forState:UIControlStateNormal];
_btntwo.tag = i+100;
_btntwo.selected = NO;
_btntwo.layer.cornerRadius = 60;
_btntwo.layer.masksToBounds = YES;
[_btntwo setBackgroundImage:[UIImage imageNamed:_selectedarray[i]] forState:UIControlStateSelected];
[self.view addSubview:_btntwo];
}
}
-(void)clickbtntwo:(UIButton *)sender{
for (int i = 0; i < _normalarray.count; i++) {
UIButton *btn = (UIButton *)[[sender superview]viewWithTag:100 + i];
[btn setSelected:NO];
}
UIButton *button = (UIButton *)sender;
[button setSelected:YES];
}