开发者

What takes up less memory when allocating: UIView or UILabel?

开发者 https://www.devze.com 2023-03-24 09:17 出处:网络
What takes up less memory when allocating:UIView or UIL开发者_运维知识库abel? thanksIn the most abstract sense, UILabel would take more memory since it inherits from UIView.

What takes up less memory when allocating: UIView or UIL开发者_运维知识库abel?

thanks


In the most abstract sense, UILabel would take more memory since it inherits from UIView.

But it really depends on what you're doing. I highly recommend that you do not attempt to replicate UILabel's functionality in a UIView. Since you do not appear to have an intimate understanding of the inner-workings of the UIKit framework, you would be doing it more inefficiently than the Apple engineers have.

Use what fits; what is easiest, and what works. It'll save you a lot more work in the long-run, especially if you write code that works well only with a certain implementation and then they end up changing implementations, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消