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 height 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.