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]; 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -