UIButton doesn't want to keep in Selected State when clicking on the button

ios, uibutton

Solution

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
}

Problem

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. The problem : 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 ?

Original source