为什么UIView(或其子类)不采用NSCopying协议? [英] Why doesn't UIView (or it's subclasses) adopt the NSCopying Protocol?

查看:100
本文介绍了为什么UIView(或其子类)不采用NSCopying协议?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Cocoahead能否解释一下为什么UIView及其子类不采用NSCopying协议?

Can a Cocoahead please explain why UIView and it's sub classes don't adopt the NSCopying Protocol?

从哲学上我可以理解为什么UITouch不兼容复制,因为它是一个非常临时的对象。通过UIView,它的子类,尤其是UIButton,似乎可以应该被复制。

I can see, philosophically, why UITouch would not be copy compliant, as it's a very temporal object. By UIView, and it's subclasses, especially UIButton, seem like they should be able to be copied.

当然,苹果公司有做事的充分理由他们的方式。您知道他们的原因吗?

Certainly Apple has good reasons for doing things the way they do. Do you know their reason?

推荐答案

似乎他们问的问题不是为什么不呢?但是为什么呢?这样做毫无意义。几乎不需要复制实时视图。通常,模板视图是通过NSCoding协议(即使用Interface Builder)创建的,几乎所有可复制的视图都将非常有用。

It would seem the question they asked wasn't "Why not?" but "Why do it?" There's little point to doing so. There's rarely a need to copy a live view. Usually, template views are created through the NSCoding protocol (i.e. with Interface Builder), and that's about all a copyable view would be good for.

这篇关于为什么UIView(或其子类)不采用NSCopying协议?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆