delegate在iphone中的确切含义是什么?它在UIViewController中是如何实现的?
what is the exact meaning of delegate in iphone?how it is implemented in UIViewController?
委托是一个对象,它通常对另一个对象中的某些事件做出反应和/或可以影响另一个对象的行为方式.为了更好地完成任务,这些对象协同工作.通常,委托对象将由许多其他需要执行更具体任务的对象共享.委托本身将更加抽象,并且对于不同的任务应该是非常可重用的.包含委托的对象通常会在触发事件发生时向委托发送消息,使委托有机会执行其指定的任务.
A delegate is an object that usually reacts to some event in another object and/or can affect how another object behaves. The objects work together for the greater good of completing a task. Typically a delegate object will be shared by many other objects that have a more specific task to carry out. The delegate itself will be more abstract and should be very reusable for different tasks. The object which contains the delegate typically sends the delegate a message when a triggered event occurs, giving the delegate an opportunity to carry out its specified task.
还有更多文档这里 您应该阅读以了解 Cocoa 和 Cocoa touch 中的委托模式,特别是如何在 UIWindow 和 UIView 之间使用委托.它是 iPhone 架构中不可或缺的设计模式,如果你想设计一个干净的应用程序,你应该掌握它.
There's more documentation here that you should read to understand the delegate pattern in Cocoa and Cocoa touch, particularly with how delegation is used between UIWindow and UIView. It is an integral design pattern in iPhone architecture and one that should be mastered if you wish to design a clean application.
这篇关于iPhone 中的代理是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!