P i*_*P i 12 animation explicit ios
我一直在读,Apple建议使用基于块的动画而不是CATransaction
以前,我使用此代码禁用动画:
[CATransaction begin];
[CATransaction setDisableActions: YES];
// !!! resize
[CATransaction commit];
Run Code Online (Sandbox Code Playgroud)
是否有新的推荐方法来执行此操作,或者这仍然可以吗?
Jos*_*erg 31
[UIView setAnimationsEnabled:NO];
//animate here
[UIView setAnimationsEnabled:YES];
Run Code Online (Sandbox Code Playgroud)
Bre*_*nes 25
对于iOS 7及更高版本,现在可以通过以下方式实现:
[UIView performWithoutAnimation:^{
// Changes we don't want animated here
view.alpha = 0.0;
}];
Run Code Online (Sandbox Code Playgroud)
斯威夫特 3+
UIView.performWithoutAnimation {
// Update UI that you don't want to animate
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18638 次 |
| 最近记录: |