iphone - how to make my button state selected untill the next button selected? -


i have 4 buttons in iphone application, added this:

uiimage *button1image = [uiimage imagenamed:@"friends.png"]; button1 = [[uibutton buttonwithtype:uibuttontypecustom] retain]; self.button1.tag=102; [button1 setimage:button1image forstate:uicontrolstatenormal]; [button1 setimage:[uiimage imagenamed:@"friends_hvr.png"] forstate:uicontrolstateselected | uicontrolstatehighlighted]; self.button1.frame = cgrectmake(90,5, 70,32); [button1 addtarget:self action:@selector(friends:) forcontrolevents:uicontroleventtouchupinside]; 

i want make button state selected time changing background when button selected, i.e., until next button selected. me working sometimes, in blink. need persisted in action. doing this:

-(void)friends:(id)sender { [button1 setselected:yes]; 

can me?

try adding line:

[button1 setimage:[uiimage imagenamed:@"friends_hvr.png"] forstate:uicontrolstateselected]; 

you using image state both selected , highlighted @ same time. (yes, it's confusing or'ing constants produces state both active.)

then deselect previously-selected button in friends: method.


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -