Reputation: 395
I'm doing a UIButtion that highlight once it clicked and it is un-highlighted when it's clicked again. I can not get to un-highlight when I click on. I have made an event listener below
(IBAction)ButtonClicked:(UIButton*)sender
{[sender setHighlighted:!sender.isHighlighted];
}
Edit: and the target action is
[button addTarget:self action:@selector(ButtonClicked:) forControlEvents:UIControlStateSelected];
Upvotes: 0
Views: 1514
Reputation: 1036
[sender setSelected:!sender.isSelected]
try this:) If this is what you want
Upvotes: 1