UINavigationController pushViewController在中途暂停/冻结
我通过以下方式推送视图控制器:
[self.navigationController pushViewController:[[UIViewController alloc] init] animated:YES];
但animation在中途停顿了半秒钟。 animation不完整。 这是gif;
有了更多的细节,我可以想到2个可能的问题。
-
是否将Shadow添加到新的ViewController覆盖的视图的代码中。 如果是这种情况,请改用ShadowPath或半透明视图(在animation制作中,属性“影子”很昂贵)
-
是新的ViewController“clearColor”的backgroundColor? 我曾经看到过这种奇怪的渲染问题。
尝试:
UIViewController *vc = [[UIViewController alloc] init]; vc.view.backgroundColor = [UIColor whiteColor]; [self.navigationController pushViewController:vc animated:YES];
这是我可以想到的两个可能的问题,我的头顶上只有很less的细节。
永远不要依赖默认的背景颜色,它与iOS版本有所不同,在控件之间不一致,如果视图是在代码或Xib(在同一个iOS版本中)创build的,甚至可以不同。
当按照VinceBurn的build议设置背景色时,解决了暂停问题,只有当animation完成时,才使整个animation变成白色,在实际内容中淡入淡出。
对于我来说,问题是通过确保内容在-viewDidLoad
大小正确来-viewDidLoad
。