-(IBAction)onClickButton:(id)sender
{
UIViewController* detail = [[UIViewController alloc] init];
[self.navigationController pushViewController:detail animated:YES];
}
这段非常简单的代码,看似没有问题,在ios7以上运行却发现在push一半的时候会卡顿一下,这是由于UIViewController是一个空的,背景色为透明的导致的。
下面的就没有问题了:
-(IBAction)onClickButton:(id)sender
{
UIViewController* detail = [[UIViewController alloc] init];
[detail.view setBackgroundColor:[UIColor whiteColor]];
[self.navigationController pushViewController:detail animated:YES];
}
本文介绍了一个iOS应用中使用UIViewController进行页面跳转时出现的卡顿问题,并提供了解决方案,即通过设置view的背景颜色来避免卡顿现象。
1万+

被折叠的 条评论
为什么被折叠?



