ios - animateWithDuration isn't animating UIButton -
ios - animateWithDuration isn't animating UIButton -
i have category on uiview should animate motion of uibutton 1 point another. beingness run, button doesn't move @ all. seems animation successful, there's no motion @ all.
the button called repeating nstimer, counts downwards point button animated (check every sec see if true, if remaining points--, when remaining points == 0 animate). there timer beingness called every 0.01 seconds work levels on microphone, if increment frequency still doesn't work.
i think animation code ok - holding animation displaying correctly. if in viewdidload before animating animates (although starts @ end point , animates i've placed button in storyboard), if animate in flow of programme doesn't work.
the category correctly outpoints end points, , after 5 seconds "done".
the category:
@implementation uiview (animation) - (void) moveto:(cgpoint)destination duration:(float)secs option:(uiviewanimationoptions)option { nslog(@"moveto category. destination: %@ , duration %f", nsstringfromcgpoint(destination), secs); [uiview animatewithduration:secs delay:0.0 options:option animations:^{ self.frame = cgrectmake(destination.x,destination.y, self.frame.size.width, self.frame.size.height); nslog(@"self.frame: %@", nsstringfromcgrect(self.frame)); } completion:^(bool finished){ nslog(@"done"); }]; } @end
the code animate:
[rewardanimationbutton moveto:cgpointmake(100, 100) duration:5.0 option:0];
did turn off autolayout xib file/ storyboard? supposedly auto layout takes on view placement, , interferes animation.
you might seek animating button's center rather frame. frame property undefined if view's transform not identity.
ios objective-c core-animation nstimer
Comments
Post a Comment