objective c - Keep UIButton highlighted after touch & iOS 7 -
i need keep uibutton
highlighted after touch event. in ios versions < 7 used following action touch inside event:
- (ibaction)clickme:(id)sender { uibutton *button = sender; [nsoperationqueue.mainqueue addoperationwithblock:^{ button.highlighted = yes; }]; }
unfortunately has changed in ios 7 , code doesn't work anymore: if tap button, button reverts normal state; interestingly, if keep button pressed little longer, button remains highlighted. please note app developed ios 6 runs in ios 7 in compatibility mode. i'm trying figure out way make app work on both ios 6 & 7 far haven't found nice solution (one workaround queue event highlights button after short delay produces annoying flickering of button). advice?
as ".highlighted
" property you're using, apple documentation states: "uicontrol automatically sets , clears state automatically when touch enters , exits during tracking , when there touch up."
why not change uiimage uibutton displays, depending on "state" want appear in? subclass uibutton, give state property can control or set, , depending on state can show different image.
Comments
Post a Comment