Question

I have some code that needs 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?

Was it helpful?

Solution

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.
    }];
}];

OTHER TIPS

This seems to be the way:

[UIView performWithoutAnimation:^{
    view.frame = CGRectMake(...);
}];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top