Custom UITabBarController moved to top leaving white area
I have a custom UITabBarController
and using setFrame in the viewDidLoad
I move the tabBar to the top of the screen. This works fine.
In Interface Builder
I have pushed down the elements (button开发者_运维技巧s, labels, etc) in the XIB
file of the so that there is room for the tabBar at the top. I have made sure to set the Bottom Bar to none (in the simulated metrics of the inspector) and made sure that the UIView
is 480 in height.
When I test this however the tabBar is at the top as expected, but the view is clipped off where the tab bar would normally be. Even the background UIImage
does not show through. It is just white. How can I increase the frame size of the viewController?
I tried changing adding a setFrame
command to [self view]
in the viewDidLoad
of the subview
, but that did not do the trick.
Thanks
UITabBarController automatically sets the frame for active view controllers.
You can try to modify the view's frame afterwards or try setting clipSubviews = NO
for all views.
Maybe you want to try to execute the following in viewDidAppear:
or some other place (try!). This will hopefully change back the frame of the view after the tab bar controller modified it.
dispatch_async(dispatch_get_main_queue(), ^(void){
[self.view setFrame:CGRectMake(0,0,320,480);
});
精彩评论