In-Call状态栏如何影响UIViewController的视图大小? [英] How In-Call status bar impacts UIViewController's view size?

查看:112
本文介绍了In-Call状态栏如何影响UIViewController的视图大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解与 UITabBarController 相关联的视图 UINavigationController UIViewController 在切换通话中状态栏时会做出反应。

我的麻烦在于它们的行为似乎有所不同这会导致我的副作用。



我做了一个项目,改变了上面3种类型的窗口的根视图控制器,我转储了描述视图以获取帧坐标。







  • UIViewController





inCall状态关闭

 
UIView:0x4e2a1f0 ; frame = (0 20; 320 460); autoresize = W + H; ....


ON

 UIView:0x4e2a1f0; frame = (0 40; 320 440);  autoresize = W + H; ... 



我理解这一点:当出现在通话状态栏时,UIViewController的视图宽度缩小并松散20,它的y coord从20变为40.



这是完美的!当用 UITabBarController UINavigationController替换经典 UIViewController 时,我希望如此code>但事实并非如此!







  • UINavigationController






InCall状态栏关闭

 UILayoutContainerView:0x4b35ab0; frame = (0 0; 320 480);  autoresize = W + H; .. 


ON

 UILayoutContainerView:0x4e1b060; frame = (0 0; 320 480);  autoresize = W + H; .. 



在这种情况下,当调用呼叫状态栏时,UINavigationController处理的视图没有更改其帧属性?! (为什么?:()







  • UITabBarController




OFF

 UIView:0x4b2f6a0; frame = (0 20; 320 460 );  autoresize = W + H; ... 


ON

 UIView:0x4b2f6a0; frame = (0 20; 320 460);  autoresize = W + H; ... 



UINavigationController UITabBarController 视图似乎不切换incall状态栏时会受到影响。






有人可以解释我在显示incall状态栏时如何调整大小出现?

我的最终目标是显示一个 UIView ,显示 ABOVE 整个 UITabBarController 并在显示呼叫状态时正确调整大小但是,我真的不知道在视图层次结构中放置这样一个视图的位置:如果我将它添加为UITabBarController视图的子视图,因为这个没有对incall状态显示作出反应,我的反应也没有: (

解决方案

切换通话中状态栏时视图的高度取决于它的锚定方式。



使用UIView的autoResizingMask来控制视图在调用状态栏显示时是向下移动还是调整大小。



这两个属性,

  UIViewAutoresizingFlexibleTopMargin 
UIViewAutoresizingFlexibleHeight

会对你有所帮助。第一个按下视图,第二个改变大小。


I'm trying to understand how the view associated to a UITabBarController, UINavigationController or UIViewController reacts when the in-call status bar is toggled.
My trouble is that they seem to behave differently and this causes me side effects.

I've made a project that changes the root view controller of the window for the 3 types above and I dump the description of the view to get the frame coordinates.


  • UIViewController

inCall status OFF:

UIView: 0x4e2a1f0; frame = (0 20; 320 460); autoresize = W+H; ....
ON
UIView: 0x4e2a1f0; frame = (0 40; 320 440); autoresize = W+H; ...

This one I understand : when the in-call status bar appears, the width of the view of the UIViewController shrinks and looses 20, and its y coord moves from 20 to 40.

That's perfect ! I would expect the same when replacing a classic UIViewController with a UITabBarController or a UINavigationController but that's not the case !


  • UINavigationController

InCall status bar OFF

UILayoutContainerView: 0x4b35ab0; frame = (0 0; 320 480); autoresize = W+H; ..
ON
UILayoutContainerView: 0x4e1b060; frame = (0 0; 320 480); autoresize = W+H; ..

In that case, the view handled by the UINavigationController does not have its frame properties changed when the in-call status bar is toggled?! (why ? :( )


  • UITabBarController

OFF

UIView: 0x4b2f6a0; frame = (0 20; 320 460); autoresize = W+H; ...
ON
UIView: 0x4b2f6a0; frame = (0 20; 320 460); autoresize = W+H; ...

Same as in the UINavigationController: the view of the UITabBarController does not seem to be impacted when the incall status bar is toggled.


Can someone explain me how this resize works when displaying the incall status bar appears ?
My end goal is to display a UIView that is shown ABOVE the whole UITabBarController and that resizes properly when the in call status is displayed. However, I really don't know where to put such a view in the views hierarchy : if I add it as a child of the UITabBarController's view, as this one does not react to the incall status display, mine does not react as well :(

解决方案

The height of the view when the In-call status bar is toggled depends on the way it's anchored.

Play around with the autoResizingMask of the UIView to control whether the view should move down or resize when the in-call status bar shows up.

These two properties,

UIViewAutoresizingFlexibleTopMargin
UIViewAutoresizingFlexibleHeight  

will help you. The first one pushes the view down, the second one changes the size.

这篇关于In-Call状态栏如何影响UIViewController的视图大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆