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

↘锁芯ラ 提交于 2019-12-20 10:47:00

问题


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


回答1:


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.

Reference

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




回答2:


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

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 bar property.



来源:https://stackoverflow.com/questions/5785735/whats-the-difference-between-outlet-and-referencing-outlet-in-a-simple-sentence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!