我有六个button的Objective-C工作代码,但我似乎没有find如何使用Swift更改button的状态。 那么如何让下面的代码在Swift中工作呢? [self.button2 setBackgroundImage:[UIImage imageNamed:@"button2_selected.png"] forState: UIControlStateSelected]; button1.selected = NO; button2.selected = !button2.selected; button3.selected = NO; button4.selected = NO; button5.selected = NO; button6.selected = NO;