navigation的pushViewController卡顿问题

问题:在ios中一个viewController中,添加下面代码:

<pre name="code" class="objc">UIViewController *testView = [[UIViewController alloc] init];<span style="font-family: Arial, Helvetica, sans-serif;">//没有做任何修改</span>
[self.navigationController pushViewController:testView animated:YES];


在push动作的时候,会出现类似于卡顿的操作。


原因:

这个新建的testViewController控制器的背景为透明,然后就出现了类似于卡顿的现象了。只要我们设置下testView.view.backgroundColor = [UIColor whiteColor];问题就解决了。


修改后代码:

UIViewController *testView = [[UIViewController alloc] init];
testView.view.backgroundColor = [UIColor whiteColor];
[self.navigationController pushViewController:testView animated:YES];



原文地址:https://www.cnblogs.com/AbeDay/p/5026925.html