ios - UIButton setSelected: NO doesnt show default background image -
i have custom uibutton
2 background images:
in default state: default.png in selected state: selected.png
set in xib file.
this gets invoked on button touch down:
-(ibaction)numberselected:(id)sender{ nslog(@"button pressed %@",[sender currenttitle]); uibutton* button = (uibutton*)sender; button.selected = !button.selected; [button release]; }
the wrong behavior this:
i press button, background image switches selected.png
(correct), press again, , no backgorund image shown. press time, app crashes. knows help? lot in advance.
no need release button there. remove
[button release];