iOS>>协议&代表概念 [英] iOS >> Protocols & Delegates Concepts

查看:157
本文介绍了iOS>>协议&代表概念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有很多关于Protocols&网络上的代表和不同的教程在不同的名称下呼叫一些参与者。

There are a lot of materials about Protocols & Delegates on the web, and different tutorials call some of the "participants" in the process by different names.

特别令人困惑的是适配器和Conformer概念

especially confusing is the "Adaptor" and the "Conformer" concepts.

我明白正在实现协议方法的类 - 即具有< ProtocolName> 声明 - 是符合议定书。是否也是协议的采用者?

I understand that the Class that is implementing the Protocol methods - i.e. the one that has the <ProtocolName> statement in it - is "Conforming to Protocol". Is it also the "Adopter" of the protocol?

如何调用协议被声明或被重新声明的类,以便它可以包括必须符合协议的属性 - 即在其接口中有一个 @protocol ProtocolName 语句?

How do I call the class in which the Protocol is declared at, or being re-declared at, so it can include a Property that must conform to the Protocol - i.e. have in its Interface a @protocol ProtocolName statement?

I找不到任何Apple官方文档解释说。

I couldn't find any Apple official documentation that explains that.

编辑

感谢指定的答案,但是我(并且已经)理解了这种语言的模式以及它是如何实现的。我的问题(并且仍然是)与不合规定有关...而且我仍然没有提到宣布/重新签署议定书的名称(概念上)。也许它没有名字,我应该称之为:协议被声明/重新声明的类。也许我可以称之为代表班(听起来不错,顺便说一下)...

Guys, thanks for the specified answers, but I do (and did) understand the pattern and how it's implemented in the language. My issues were (and still are) relating to the NAMING... and still, I could not find any reference to "what is the name (conceptually) of the class that DECLARES/REDECLARES the Protocol". Maybe it has no name, and I should just call it: "The Class in Which the Protocol is Declared/Redeclared". Maybe I can call it "The Delegating Class" (which sounds good, by the way)...

推荐答案

语义学。我会说它的动作vs结果。

Semantics. I would say its action vs result.

通过采用一个协议(动作),你符合它(结果)

By adopting a protocol (action), you're conforming to it (result)

这篇关于iOS&gt;&gt;协议&amp;代表概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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