本文介绍了什么是iPhone代表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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代表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 02:54