Difference between a Scene and a View in iOS

陌路散爱 提交于 2019-12-03 03:23:17
Kunal Balani

In simple terms:

View

A UIView is a rectangular area that is displayed on the screen.

ViewController

A collection of Views displayed on the screen at the moment.

In the following image, blue area and yellow area are Views, whereas the entire screen is a ViewController.

Scene

A ViewController which is a part of a specific sequence.

However, the technical definitions are a little different:

UIView

A UIIView is a wrapper to CALayer. It holds an array of subviews which implies that it's a collection of views by itself. You can imagine this as a tree structure.

ViewController

A ViewController is a controller which holds a reference to the root view. This way, you can traverse the leaf node or any subview from the controller.

Scene

"Scene" is another term for a ViewController in one context of storyboard.

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