iOS代表的目的是什么? [英] What is the purpose of an iOS delegate?

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

问题描述

我了解委托在iOS中的作用,我看了示例代码,但我只是想知道这种封装的优点(而不是在主对象中包含委托方法)。

I understand what a delegate does in iOS, and I've looked at sample code, but I'm just wondering about the advantages of this type of encapsulation (as opposed to including delegate methods in the primary object).

推荐答案

代表团是设计模式,不仅用于iOS但许多其他语言。它使您能够在类层次结构中处理值和消息。

Delegation is a design pattern not only used in iOS but many other languages. It enables you to hand values and messages over in your class hierarchy.

这篇关于iOS代表的目的是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆