简体   繁体   English

使UIView大于其父视图

[英]make UIView bigger than its parent view

I'm making an iPad app and I have a UIView structure as follows: 我正在制作一个iPad应用程序,并且具有如下UIView结构:


ViewA (parent) --> ViewB (subview to ViewA) --> ViewC (subview to ViewB) ViewA(父级)-> ViewB(ViewA的子视图)-> ViewC(ViewB的子视图)

ViewA is the same size as the screen. ViewA与屏幕大小相同。
ViewB is about half the size of the screen. ViewB大约是屏幕大小的一半。
ViewC is half the size of ViewB. ViewC的大小是ViewB的一半。

Upon a certain event, I want to modify ViewC's frame so that ViewC covers the entire screen. 在发生某个事件时,我想修改ViewC的框架,以使ViewC覆盖整个屏幕。 What's the best way to do this? 最好的方法是什么? I'd rather not have ViewC's frame go outside of ViewB (and I can't change ViewB's frame). 我宁愿不要将ViewC的框架移到ViewB之外(并且不能更改ViewB的框架)。

Thanks! 谢谢!

Sunny 阳光明媚

As I see it, view B is no longer relevant if view C will occupy the whole screen. 如我所见,如果视图C将占据整个屏幕,则视图B将不再相关。 Is it possible/safe to remove the subview C from B in your design? 从设计中的B中删除子视图C是否可行/安全?

If so, then remove C from B, and then add it as a subview to A. You can even do it with an animation, using the static method transitionWithView:duration:options:animations:completion: from UIView . 如果是这样,则从B中删除C,然后将其作为子视图添加到A。您甚至可以使用动画,使用UIView中的静态方法transitionWithView:duration:options:animations:completion:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM