菜鸟教程小白 发表于 2022-12-12 13:27:05

ios - 加快 Storyboard打开速度


                                            <p><p>当我打开 Storyboard文件时,由于其中包含 VC 的数量,它需要 1-2 分钟才能打开。加快速度的最佳做法是什么?我们是否应该将一些 VC 移动到不同的 Storyboard文件中?我们是否应该使用更多的 xib 文件来减少 VC 中的元素数量?任何建议都会很好地说明我们可能实现了哪些不良做法以使 Storyboard加载时间如此缓慢。 </p></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p><strong>良好做法:</strong></p>

<ol>
<li>将您的 <code>ViewControllers</code> 保存在不同的 <code>storyboard</code> 中,它们在逻辑上彼此不相关。会<br/>
大大减少 Storyboard渲染/打开时间。它还将
在使用<br/>时避免 Storyboard中的冲突非常有帮助
团队。</li>
<li>尝试将 UI 元素添加到 <code>xib</code> 文件中,例如 <code>tableViewCell</code>、<code>collectionViewCell</code>、<code>buttons</code> 等</li >
<li>尝试使用代码而不是 <code>IBInspectable</code>/<code>IBDesignable</code> 自定义 UI 对象。</li>
</ol>

<p><strong>不好的做法:</strong> </p>

<ol>
<li>将所有 ViewController 保存在单个 Storyboard文件中。因为渲染 Storyboard文件中的所有 UI 对象及其在 Storyboard中的位置将花费大量时间。</li>
</ol>

<p>谢谢</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 加快 Storyboard打开速度,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/44125590/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/44125590/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 加快 Storyboard打开速度