How does sender.selected = ! sender.selected toggle between selected states?
问题 I'm very new to Objective-C so sorry if this is extremely obvious to many of you, but I'm trying to work out how the following piece of code is actually working: - (IBAction)chooseColour:(UIButton *)sender { sender.selected = !sender.isSelected; } Now it obviously toggles between the selected and unselected states of the button sending the action, but what is the code 'sender.selected = !sender.isSelected' actually saying? Is it just 'set the sender selected property to the opposite (i.e. !