简体   繁体   English

情节提要非常慢

[英]Storyboard is very slow

So I've been working on a project for a while that has so many view controllers, but I notice that now when I try to do a single edit in any view , storyboard hangs, or become unresponsive . 因此,我已经在一个有很多视图控制器的项目上工作了一段时间,但是现在我注意到,当我尝试在任何视图中进行单个编辑时,情节提要挂起或变得无响应。 what would be the solution for this issue ? 该问题的解决方案是什么? is it possible at my current state to split up the whole storyboard into smaller ones ? 在目前的状态下,是否可以将整个故事板拆分成较小的故事板? and will that resolve the problem ? 并能解决问题吗? I'm using Xcode 9.3 我正在使用Xcode 9.3

Yes. 是。 You can have more than one storyboards in one project. 一个项目中可以有多个情节提要。 In fact that's the preferred way to manage very large projects. 实际上,这是管理大型项目的首选方法。 To create more storyboards go to File Menu > New > File... and then select Storyboard from the User Interface section. 要创建更多情节提要,请转到“文件”菜单>“新建”>“文件...”,然后从“用户界面”部分中选择“情节提要”。 Doing this should resolve your issue. 这样做应该可以解决您的问题。 However, if the issue still persist you can consider taking out the specific user interface into its own .xib file. 但是,如果问题仍然存在,则可以考虑将特定的用户界面放入其自己的.xib文件中。

在此处输入图片说明

Update: 更新:

If I were in your position I would have considered using .xib files to create my user interface instead of using storyboards. 如果我在您的位置,我会考虑使用.xib文件创建用户界面,而不是使用故事板。 Storyboards do have their advantages but there are some cons too if you use them. 故事板确实有其优点,但如果使用它们,也有一些缺点。 Like: 喜欢:

  • If you work in a team you will run into merge conflicts more often because someone else made a change in the storyboard. 如果您在团队中工作,您将更容易遇到合并冲突,因为其他人在情节提要中进行了更改。
  • I am still not a Guru in S/W design but, to me it seems like Storyboards violate the Single Responsibility Principle of S/W design. 我仍然不是S / W设计方面的专家,但对我而言,情节提要似乎违反了S / W设计的单一责任原则。
  • You won't be using Segues in complex ui flows anyways so what's the point of having every thing in one file. 无论如何,您都不会在复杂的ui流中使用Segues,因此将所有内容都存储在一个文件中有什么意义。
  • You won't be able to reuse your UITableViewCells interface. 您将无法重复使用UITableViewCells接口。 Prototype Cells are a good idea but if you have a UITableViewCell which is used in more than one UITableView you will have to replicate the UI in Storyboard. 原型单元是一个好主意,但是如果您有一个UITableViewCell用于多个UITableView,则必须在Storyboard中复制UI。
  • In my experience, in a more complex and large project having everything in one Storyboard makes it even hard to comprehend the UI/UX flows as Segues from every view controller seem to connect with every other view controller to the point where it just stops making sense at all. 以我的经验,在一个更复杂,更大型的项目中,所有内容都放在一个Storyboard中,这使得理解UI / UX流程变得更加困难,因为每个视图控制器的Segues似乎都与其他所有视图控制器连接在一起,直到它不再有意义为止完全没有

Yes, it is best practise to distribute viewConrollers into multiple storyboards so that you can open it quickly but it can lead your time to manage each storyboard identification programatically while accessing into code. 是的,最佳实践是将viewConrollers分配到多个情节提要中,以便您可以快速打开它,但它可能会导致您花费时间在访问代码时以编程方式管理每个情节提要标识。

Otherwise, you can set storyboard View as : iPhone 5C so that it can load little bit faster than bigger devices. 否则,您可以将情节提要板View设置为:iPhone 5C,这样它可以比大型设备快一点的加载速度。

Refer: 参考: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM