开发者

Can we add more than one subviews to a window at the same time in iOS?

开发者 https://www.devze.com 2023-02-13 22:24 出处:网络
Is it possible to开发者_如何学JAVA add more than 1 subviews to a given window. Eg. [window addsubview: subview1] [window addsubview: subview2] where one of the views is UIViewController.

Is it possible to开发者_如何学JAVA add more than 1 subviews to a given window. Eg. [window addsubview: subview1] [window addsubview: subview2] where one of the views is UIViewController. I tried doing it but the UIViewController view overrides the other subview.


Make sure both the views do not have the same size, so they do not overlap each other. Try changing one view's x and y location and background colour to something that stands out from the other one to see what I mean.

A quick look at the UIWindow docs would have revealed it inherited from UIView, to which you can add an arbitrary number of subviews.


Yes you can add multiple subviews to UIWindow.

For your problem check the frames of the views you add - probably your viewController's view is fullscreen and another view is just under it

0

精彩评论

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

关注公众号