【发布时间】:2020-08-30 11:34:38
【问题描述】:
如果我们从 storyboard/xib 到 ViewController/View 创建了许多 IBOutlet,那么会不会导致性能开销?如果有怎么办?
【问题讨论】:
标签: ios objective-c swift xcode storyboard
如果我们从 storyboard/xib 到 ViewController/View 创建了许多 IBOutlet,那么会不会导致性能开销?如果有怎么办?
【问题讨论】:
标签: ios objective-c swift xcode storyboard
请参阅 Apple Developer 中的 IBOutlet 定义。
我们可以看到这个
the more outlets an object has, the more memory it takes up.
If there are other ways to obtain a reference to an object,
such as finding it through its index position in a matrix,
or through its inclusion as a function parameter,
or through use of a tag (an assigned numeric identifier),
you should do that instead.
所以会造成性能开销。
更多详情,您可以查看文档。
【讨论】:
是的。这就是为什么您应该根据您的目的创建许多故事板。 例如:设置 Storyboard、Main Storyboard、User Storyboard、Picker Storyboard。
【讨论】: