有人能用一个例子解释一个委托人是什么? [英] Can someone explain what a delegate is with an example?
问题描述
我读了很多关于目标c委托,但没有得到清楚的idea.Can任何人解释它与
一个好的和精确的例子,所以我可以理解它。高级感谢您的回复。
i read a lot about objective c delegate but didn't get clear idea.Can anyone explain it with a good and precise example so that i can understand it. Advanced thanks for your reply.
推荐答案
这里是我对代表的回答及其工作原理:在Cocoa中解析XML
Here's an answer I gave about delegates and how they work: Parsing XML in Cocoa
这通常被称为策略模式 ,您可以在维基百科上阅读所有相关内容: http://en.wikipedia.org/wiki/Strategy_pattern
It's most commonly known as the "Strategy Pattern", and you can read all about it on Wikipedia: http://en.wikipedia.org/wiki/Strategy_pattern
这也是对象组成的一个轻微变化: http://en.wikipedia.org/wiki/Object_composition
It is also a slight variation on object composition: http://en.wikipedia.org/wiki/Object_composition
这篇关于有人能用一个例子解释一个委托人是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!