开发者

how to update UI before UIView animation

I add an animation to UIView in my program. There are many controls in the view. I tried to hide some controls before animation, so I set hidden property to YES. But it didn't work.It still visible on the layer during the animation.

here is some code:

button.hidden = YES;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
[UIView commitAnimations]

Could any one tell me how to hide controls before an开发者_StackOverflow社区imation? Or how to update control statues(control position, visible, etc)

thanks


If you're trying to animate a view, the statement that sets its new value, like (button.hidden = YES), should be located INSIDE your animation block, like so.

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self.view cache:YES];
button.hidden = YES;
[UIView commitAnimations];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜