Reputation: 725
I am trying to figure out what's wrong here, because as you can in the screenshots a different image is given for both, selected and default state.
when I run on simulator, I click on the button, it shows the image of highlited state, and then back to the normal state without keeping changed at the selected state ! any hints or ideas about this particular issue ?
Upvotes: 3
Views: 1443
Reputation: 589
You should manually set selected state to YES in code when the button is pressed
- (IBAction)btnTapped:(UIButton*)button {
button.selected = !button.selected; // to switch from selected to unselected and vice versa
}
Upvotes: 5
Reputation: 4792
I think you should add a target to this button and in that method, you should write
button.selected=YES; //then only the image will change.
Upvotes: 1