我有一些代码需要在UIView
动画括号内运行,但我希望它不被动画化,所以它两侧的所有代码都被动画化了,但它没有。有办法做到这一点吗?
这似乎是一种方式:
[UIView performWithoutAnimation:^{
view.frame = CGRectMake(...);
}];
没有代码可以直接插入UIView动画块中将其从动画中排除,但您可以为任意复杂的动画链嵌套UIView动画和完成块:
[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.
}];
}];