iphone - Button setHighlighted not working -
i have button want highlight using highlighted attribute. in interface builder, highlighted attribute works , changes button visibly highlighted state. however, in code, when write [mybutton sethighlighted:yes]; nothing changes. ideas why doesn't work?
please remember correct behaviour next: highlighted state button when button tapped, changing button state isn't correct. there control state appropriate, selectedstate
if modify selected state in ibaction of button work. hacking highlighted state of button in moment tap on it, it's wrong.
-(ibaction)touch:(uibutton *) tappedbutton { [mybutton setselected:yes] }
you need provide resources selectedstate. can via xib ( choose state button in attributes inspector selected , can add textcolor background etc.) or via code:
[self.button setimage:[uiimage imagenamed:image] forstate:uicontrolstateselected];
Comments
Post a Comment