加快故事板打开速度 [英] Speed Up Storyboard Opening
本文介绍了加快故事板打开速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我打开故事板文件时,由于其中包含的 VC 数量太多,需要 1-2 分钟才能打开.加快速度的最佳做法是什么?我们应该将一些 VC 移动到不同的故事板文件中吗?我们是否应该使用更多的 xib 文件来减少 VC 中的元素数量?任何关于我们可能实施的不良做法使故事板加载时间如此缓慢的建议都会很好.
When I open the storyboard file, it takes between 1-2 minutes to open because of the number of VCs I have in it. What is the best practice to speed it up? Should we move some VCs into different storyboard files? Should we use more xib files to reduce the number of elements in VCs? Any suggestions would be great on what poor practices we might have implemented to make the storyboard loading time so slow.
推荐答案
良好做法:
- 将您的
ViewControllers
保存在不同的storyboard
中,这些storyboard
在逻辑上彼此不相关.它会
大大减少故事板渲染/打开时间.它也会使用
时避免故事板中的冲突非常有帮助团队. - 尝试将 UI 元素添加到
xib
文件中,例如tableViewCell
、collectionViewCell
、buttons
等 - 尝试使用代码而不是
IBInspectable
/IBDesignable
来自定义 UI 对象.
- Keep your
ViewControllers
in differentstoryboard
which are not logically related to each other. It will
considerably reduce story board rendering/opening time. It will also very helpful to avoid conflicts in storyboard when working with
teams. - Try to UI elements to
xib
file, liketableViewCell
,collectionViewCell
,buttons
, etc - Try to customise UI objects using code rather than
IBInspectable
/IBDesignable
.
不良做法:
- 将所有视图控制器保存在单个故事板文件中.因为渲染故事板文件中的所有 UI 对象及其在故事板中的位置需要很多时间.
谢谢
这篇关于加快故事板打开速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文