xcode 一个简单的句子中的 outlet 和引用 outlet 有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5785735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 20:54:53  来源:igfitidea点击:

What's the difference between outlet and referencing outlet in a simple sentence?

iphonexcodeinterface-builder

提问by user4951

Is outlet connect to a subview and referencing outlet connect to the stuff? Is that it?

插座是否连接到子视图并引用插座连接到东西?是这样吗?

回答by visakh7

The term referencing outlet means an outlet in another object that references, or points to, the current object.

术语引用出口是指另一个对象中引用或指向当前对象的出口。

As an example, say you have a nib that has a File's Owner and a UITableView in it, among other things. In order for a tableview to work it has a datasource and delegate, which are outlets and can be connected in IB. From the standpoint of the tableview the datasource and delegate are outlets. From the standpoint of the File's Owner the datasource and delegate in the tableview are referencing outlets.

例如,假设您有一个包含文件所有者和 UITableView 的笔尖,等等。为了让 tableview 工作,它有一个数据源和委托,它们是出口,可以在 IB 中连接。从 tableview 的角度来看,数据源和委托是出口。从文件所有者的角度来看,tableview 中的数据源和委托是引用出口。

Reference

参考

This previous SO question describes referencing outlet What is a referencing outlet?

前面的 SO 问题描述了引用插座什么是引用插座?

回答by Anomie

An outlet is a place on the object that you can connect something to. For example, if you have a FooViewControllerthat has an outlet named bar, you might connect an object BazView to that outlet so the barproperty on the FooViewController instance points to the BazView object after the nib is loaded.

插座是物体上可以连接某些东西的地方。例如,如果您有一个FooViewController名为 的插座bar,您可以将一个对象 BazView 连接到该插座,以便在bar加载笔尖后 FooViewController 实例上的属性指向 BazView 对象。

A "referencing outlet" is just IB showing you that this object is connected to an outlet on some other object. To use the same example, when you looked at the BazView instance in IB, it would show you a "referencing outlet" to let you know that the BazView is connected to the FooViewController's barproperty.

“参考插座”只是 IB 向您显示此对象已连接到某个其他对象上的插座。使用相同的示例,当您查看 IB 中的 BazView 实例时,它会显示一个“引用插座”,让您知道 BazView 已连接到 FooViewController 的bar属性。