iOS: 创建多个 IBOutlets 有性能开销吗?
iOS: Creating many IBOutlets has performance overhead?
如果我们从 storyboard/xib 到 ViewController/View 创建许多 IBOutlet,那么它会导致性能开销吗?如果有怎么办?
是的。这就是为什么你应该根据你的目的创建许多故事板。
例如:设置 Storyboard、Main Storyboard、User Storyboard、Picker 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/xib 到 ViewController/View 创建许多 IBOutlet,那么它会导致性能开销吗?如果有怎么办?
是的。这就是为什么你应该根据你的目的创建许多故事板。 例如:设置 Storyboard、Main Storyboard、User Storyboard、Picker 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.
所以会造成性能开销。
更详细的可以看文档