Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
代表类似于“主人”的狗。我正在考虑一个重要实例变量的名称,该变量必须持有对委托的这个“主”的弱引用。这个有官方名称吗?
Apple在Cocoa Fundamentals Guide,Cocoa Design Patterns 部分中将其称为宿主对象/类。
也许你在想“下属”?
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/20000043-1044135
您的委托不应引用其委托的对象。相反,主对象应该将自己作为参数传递给委托方法。这样,一个对象就可以委托给多个独立对象。