开发者

Confused in UIKit view hierachy

开发者 https://www.devze.com 2023-02-25 01:06 出处:网络
I am little bit confused for unusual view hierachy present for UIWIndow. If any one refer to apple UIKit Reference for UIWindow then UIView is the super class for UIWindow

I am little bit confused for unusual view hierachy present for UIWIndow.

If any one refer to apple UIKit Reference for UIWindow then UIView is the super class for UIWindow

NSObject->UIResponder->UIView->UIWindow.

But when one create a new project in XCode, there is a single MainWindows.xib and it contains the rest of views in the project.That means UIWindow is the super class for UIView.So UIWindow is child as well as Parent of UIView.Thats very confusing for any one.

So can any开发者_Go百科 one have the clear idea related to this.


Don't confuse inheritance hierarchies with view hierarchies.

A UIView instance can have many subviews of type UIView so a UIWindow is a UIView and so it can contain other UIViews as subviews.

Look at all the other UI components like UIButton or a UILabel they are all inheriting from UIView, so you are able to add them to your view as subview.

0

精彩评论

暂无评论...
验证码 换一张
取 消