ios - UIBarButtonItem: Change title font colour during animation -
i've initialized uibarbuttonitem custom uibutton , set rightbarbuttonitem within navigation controller.
uibarbuttonitem *rightbarbuttonitem = [[uibarbuttonitem alloc] initwithcustomview:rightnavigationbutton];//rightnavigationbutton custom uibutton set before self.navigationitem.rightbarbuttonitem = rightbarbuttonitem;
via appearance proxy of uibutton set colours uicontrolstates (normal/disabled/highlighted). uibarbuttonitem behaving expected.
when "save-button" pressed, want highlight uibarbuttonitem give visual feedback has been saved. i'm trying simulate highlighting of uibarbuttonitem through changing color of title during saving animation since doesn't seem can trigger highlighting animation (or set selected property) programmatically (also mentioned in post)
so did set iboutlet property, hooked uibarbuttonitem in interfacebuilder , assigned rightbarbuttonitem it. when "save-button" pressed i'm trying this:
[uiview animatewithduration:0.5f delay:0.0f options:uiviewanimationcurveeaseout animations:^{ //some other animation code here [self.barbuttonitemoutlet settitletextattributes:[nsdictionary dictionarywithobjectsandkeys: [uifont fontwithname:font_icon size:fontsize],uitextattributefont, highlight_colour,uitextattributetextcolor, [nsvalue valuewithuioffset:uioffsetmake(0, 0)],uitextattributetextshadowoffset, [uicolor colorwithred:0 green:0 blue:0 alpha:0.0],uitextattributetextshadowcolor,nil] forstate:uicontrolstatenormal]; } completion:nil ];
but there nothing happening @ all. way got somehow work disable/enable it. since colouring disabling , highlighting should different , need both of these states not option.
any appreciated!
well, docs of uiview class say: following properties of uiview class animatable:
@property frame @property bounds @property center @property transform @property alpha @property backgroundcolor @property contentstretch
so color cannot animated, sorry.
edit: answer concerned uiview
animations, there calayer
animations more flexible.
i found this link, , maybe can animate color if use calayer
animation. let me it.
edit: found this useful book chapter on core animation. unfortunately not seem solve problem, since title color of uibarbuttonitem
seems not property of calayer
animated. sorry, quit...
Comments
Post a Comment