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

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -