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? -

java - How to create Table using Apache PDFBox -

mpi - Why is MPI_Bsend not returning error even when the buffer is insufficient to accommodate all the messages -