开发者

Exclude certain actions from animating in a UIView animation block?

I have some code that n开发者_JAVA技巧eeds to run inside UIView animation brackets, but I want it be exempt from being animated, so all the code on either side of it is animated but it isn't. Is there a way to do this?


This seems to be the way:

[UIView performWithoutAnimation:^{
    view.frame = CGRectMake(...);
}];


There isn't code that you can just insert into a UIView animation block to exclude it from animation, but you can nest UIView animation and completion blocks for arbitrarily complicated animation chains:

[UIView animateWithDuration:0.3f animations:^ {
    // Animation Code.
} completion: ^ (BOOL finished) {
    // Non-animated code, executed after first animation block...
    // Blah;
    // [Blah blah];
    [UIView animateWithDuration:0.3f animations:^ {
        // More animation code.
    }];
}];
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜