Why my label is under tab bar from UITabbarController inside ViewContainer

丶灬走出姿态 提交于 2019-12-12 02:52:06

问题


I just create a new project template for TabBar application in Xcode.

I arrange a storyboard to let a UITabbarController embedded in another view controller like this (in order to provide red header for all tab pages)

Notice that in first tab page, I put two labels on the first page. Both are locating at the top and bottom of the screen.

and here is a setting of first tab view controller.

and this is the result i have got on both device and simulator.

Why and how can my second label half shown? i try to uncheck all options and setting

self.automaticallyAdjustsScrollViewInsets = NO;
self.edgesForExtendedLayout = UIRectEdgeNone;

but none is working.

How can I solve this?

Thanks.

UPDATE

I already know what is the culprit behind this. It is the tabbar's height for ipad landscape mode normally the height is 49 but according to apple here

They said the height will be 56 for ipad.

But in interface builder, it is always 49 and and the rootviews of my viewcontroller in each tab are calculate using this 49 height of tabbar even though i use an autolayout.

So I have a way to overcome this by create another view and let it has smaller height by 7 pixel from rootview.

But WHY interface builder display 49 pixel of tabbar instead of 56?


回答1:


It is not quite clear to me what you are really asking, but if you simply want a red header at the top of your view controllers, you can embed them inside of an UINavigationController. Even if you still want a UITabBarController, embed every child view inside of a UINavigationController and then you can control the look of your header.

(Note: I would just add this as a comment but I don't have the reputation.)



来源:https://stackoverflow.com/questions/24169546/why-my-label-is-under-tab-bar-from-uitabbarcontroller-inside-viewcontainer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!