1
votes

I'm having a login view that accepts username and password. Upon successful authentication, i'll present a view controller that has tab bar view (IBOutlet) with 3 tabs. Each tab bar view controller has navigation controller (but no table view in any of the view controllers). Usign xib, i added tab bar controller object, then added navigation controllers under tab bar tree and added view controllers accordingly to the 3 navigation controllers. Upon successful authentication, i'm calling [self presentViewController:myViewController animated:YES] This is how its being shown.

Screen shot

In myViewController's viewDidLoad, I'm adding tab bar as follows:

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.tabBarController.view];  
}

Why is the gap seen above nav bar and below status bar. Due to that gap, tab bar at the bottom is being cut.......

2
I'm not exactly sure what you are doing but it sounds as if your setup if wrong. Instead of using a ViewController with a TabBar inside it, use a Tab Bar Controller and see if this helps :)Phlibbo
How can I create a new tab bar controller and associate a class to it?Satyam

2 Answers

5
votes

It is a common problem, the tabBarController and also other Controller have by default the statusbar in its frame cordinates to resolve this, just set the bounds of your view to the frame of the tabBarController view.

tabBarController.view.frame = self.view.bounds;
0
votes

In a case self.view.bounds was not in accurate position. So following was helpful to me.

self.view.frame = [[UIScreen mainScreen] bounds];
CGRect cgp = self.view.bounds;
[self.tabBarController.view setFrame:cgp];

In another case(iOS 7) tabBar hides itself to the bottom of screen. In this case

self.view.frame = [[UIScreen mainScreen] bounds];
CGRect cgp = self.view.bounds;
if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) {
    cgp.size.height = cgp.size.height-90;
}
[self.tabBarController.view setFrame:cgp];