慢的UIViewController加载时间(慢ClientState警告) [英] Slow UIViewController load time (slow ClientState warning)

查看:340
本文介绍了慢的UIViewController加载时间(慢ClientState警告)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我转换一个旧的应用程序到iOS 6,我开始在我的控制台得到如下信息。

Since I converted an old app to iOS 6 I've started getting the following message in my console.

警告:慢默认关键ClientState访问了0.023656秒,公差为0.020000

除了更新我的code从的iOS 5到iOS 6,我也切换到自动布局。我已经运行仪器/时间探查和 RootViewController的在我的appDelegate就是问题所在。每次我切换视图控制器它吮吸时茫茫大,(无论我是否实例化视图控制器或者一个已经存在重新使用)。

Other than updating my code from iOS 5 to iOS 6, I also switched over to auto-layout. I've run Instruments/Time Profiler and the rootViewController in my appDelegate is the problem. Everytime I switch view controllers it sucks the vast major of the time, (regardless of whether I have to instantiate the view controller or re-using one which already exists).

window.rootViewController = myViewController;

我知道是什么方法做表面上,但我不知道在幕后发生了什么......什么会导致它是现在慢,我能做些什么来加快步伐?

I know what the method does superficially, but I'm not sure what happens under the covers... what would cause it to be slow now and what can I do to speed it up?

编辑:我已经试过把我的故事板关闭自动布局和问题消失(当然,我的UI布局是一团糟)。所以,显而易见的结论是,这是一些关于自动布局。我可能不到70次的所有组合在屏幕上,并给他们布置所需的各种约束。我有一个很难相信自动布局是慢得多(从80毫秒〜具有自动布局关闭以〜1370ms与自动布局打开)。

I've tried taking my storyboard off auto-layout and the problem vanishes (of course my UI layout is in shambles). So the obvious conclusion is, it's something about auto-layout. I've probably just under 70 views all combined on the screen and the various constraints needed to lay them out. I have a hard time believing auto-layout is that much slower (from ~80ms with auto-layout turned off to ~1370ms with auto- layout turned on).

推荐答案

在屏幕上有70次听起来很多!我的建议是为更简单以某种方式:

Having 70 views on-screen sounds like a lot! My proposal is to make it simpler in some way:


  • 你真的需要在同一时间的所有70次?

  • Do you REALLY need all 70 views at the same time?

检查是否所有的意见需要自动布局,删除它在那里,可以没有

Check if all views need autolayout, remove it where-ever possible

可以拆分成故事板几个较小的例如一个用于登录,详细信息,编辑模式等缓慢的部分原因可能来自不必处理(太)大故事板系统。

Can you split storyBoard into several smaller ones e.g. one for login, details, edit mode etc. Part of the slowness might come from system having to deal with (too) big storyBoards.

这篇关于慢的UIViewController加载时间(慢ClientState警告)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆