简体   繁体   中英

What's the name of the object, that has an delegate?

The delegate is something like the dog from the "master". I'm thinking about the name for an important instance variable that has to hold a weak reference to this "master" of the delegate. Is there any official name for this?

Apple在“ 可可基础指南”的“可可设计模式”部分中将其称为主机对象/类

Your delegate shouldn't have a reference to the object it is delegate for. Instead the main object should pass itself as a parameter to the delegate methods. That way a single object can be delegate for multiple independent objects.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM