我有一个自定义 Segue,它使用 UIViewAnimationOptionTransitionFlipFromLeft 在视图之间进行转换。
当新视图出现在屏幕上时,由于导航栏元素从左对齐状态跳转到适当的位置,会出现短暂但明显的“闪烁”。以下是在过渡结束时捕获的屏幕截图:
You can see that the title and two bar button items are left aligned; completely out of place from where they will eventually rest.
以下是转换完成后捕获的屏幕截图:
Here the buttons and title are positioned correctly. During the instant between the first and second images, the icons blink into position.
该视图是在情节提要中设置的。该视图不是 UINavigationController 层次结构的一部分,因此导航栏及其项目是通过属性检查器“模拟指标”->“顶部栏:半透明导航栏”在视图上手动创建的。
如何强制导航栏项目在过渡过程中首次出现时正确定位?
先感谢您! :)
知道了!我发现在transitionWithView中使用 [UIView PerformWithoutAnimation:^{}] 块解决了这个问题:
[UIView transitionWithView:src.navigationController.view duration:0.2
options:UIViewAnimationOptionTransitionFlipFromLeft
animations:^{
[UIView performWithoutAnimation:^{
[navController setViewControllers:[NSArray arrayWithObject:dst] animated:NO];
}];
}
completion:nil];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)