use*_*625 29 uiviewcontroller uinavigationcontroller pushviewcontroller
我推ViewController
它含有不太多的意见,UIScrollView
这里面包含10次,我有一个单身ViewController
,没有再次释放和分配一次又一次地推ViewController
,所以所有的事情,我在做viewDidLoad()
,和viewWillAppear()
,但动画是缓慢的,波涛汹涌,它可能是什么?
Joe*_*oel 92
我有一个问题,当UIViewController A执行pushViewController推UIViewController B时,推动画将停止在25%左右,停止,然后在剩下的路上滑动B.
这个DID不会发生在iOS 6上,但是当我开始在XCode 5中使用iOS 7作为基础SDK时,就会发生这种情况.
修复是视图控制器B在其根视图上没有设置backgroundColor(根视图是viewController.view的值,您通常在loadView中设置).在该根视图的初始化程序中设置backgroundColor可以解决问题.
我设法修复如下:
// CASE 1: The root view for a UIViewController subclass that had a halting animation
- (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame])) {
// Do some initialization ...
// self.backgroundColor was NOT being set
// and animation in pushViewController was slow and stopped at 25% and paused
}
return self;
}
// CASE 2: HERE IS THE FIX
- (id)initWithFrame:(CGRect)frame
{
if ((self = [super initWithFrame:frame])) {
// Do some initialization ...
// Set self.backgroundColor for the fix!
// and animation in pushViewController is no longer slow and and no longer stopped at 25% and paused
self.backgroundColor = [UIColor whiteColor]; // or some other non-clear color
}
return self;
}
Run Code Online (Sandbox Code Playgroud)
您可以首先使用“仪器”>“时间分析器”,查看代码中是否有任何部分花费的时间超过必要的时间。
您还可以使用“仪器”>“核心动画”工具,该工具可用于标记屏幕上无法有效绘制/动画的部分。
如果您使用的是旧 iPhone 或原始 iPod - 屏幕复杂,我注意到一些应用程序有点不稳定。
归档时间: |
|
查看次数: |
17910 次 |
最近记录: |