View hierarchy-视图层次

今天看了iOS开发者视图层次的介绍,这里简单记录一下,要是有人把上面的内容翻译一下就好了。或者能整理一些新手需要学习的内容,希望能推荐给我。

View hierarchy

A view hierarchy defines the relationships of views in a window to each other. You can think of a view hierarchy as an inverted tree structure with the window being the top node of the tree. Under it come views structurally specified by parent-child relationships. From a visual perspective, the essential fact of a view hierarchy is enclosure: one view contains one or more other views, and the window contains them all.(讲了视图像一个倒树)

The view hierarchy is a major part of the responder chain(相应链), and it is something that the application frameworks use to determine the layering order of views when they render the content of a window in a drawing pass. The view hierarchy is also the governing concept behind view composition: You construct compound views by adding subviews to a superview. Finally, the view hierarchy is a critical factor in the multiple coordinate systems found in a window.

Art/view_hierarchy_enclose.jpg

Three View Properties Define Relationships in the Hierarchy

A view is related to other views through two properties, and these relationships determine the form of the hierarchy:

  • superview — The view above a given view in the hierarchy; this is the view that encloses it.

    All views except the topmost view must have a superview.

  • subviews — The views below a given view in the hierarchy; these are the views that it encloses.

    A view may have any number of subviews, or it may have none.

Art/view_hierarchy_relationships.jpg

Views also include another property that identifies their window.

In iOS, a Window is a View

In OS X a window has a single “content view,” a background view from which, structurally, all other views in the hierarchy descend. However, in iOS applications, a window is a view (UIWindow inherits from UIView), and so it acts as its own content view.

Prerequisite Articles

Definitive Discussion

  • The View Hierarchy

Sample Code Projects

  • (None)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值