views:

747

answers:

2

I have a UITabBarController that adds a viewController, but the positioning is off. There is about a 20px gap at the top of the screen and the bottom of the loaded viewController is hidden. How do I move resize the loaded viewController?

viewController = [[FlashCardViewController alloc] initWithNibName:@"FlashCardViewController" bundle:[NSBundle mainBundle]];
viewController.view.bounds = [[UIScreen mainScreen]bounds];
//viewController.view.alpha = 0.0;
//[self.view addSubview:viewController.view];

tabBarController = [[UITabBarController alloc] initWithNibName:nil bundle:nil];
tabBarController.viewControllers = [NSArray arrayWithObject:viewController];
tabBarController.view.alpha = 0.0;
[self.view addSubview:tabBarController.view];

I tried both of these but no luck.

tabBarController.view.bounds = [[UIScreen mainScreen] bounds];
tabBarController.view.frame = [[UIScreen mainScreen] bounds];

That's not really what I am trying to do anyway. I want to set them to the tabBarController viewing window size and position.

+1  A: 

20 pixels sounds suspiciously like the height of the status bar.

I suggest you open up your FlashCardViewController.xib file and double check that for your view under "simulated interface elements" you have nothing selected in "status bar". That should then move your view up by 20 pixels.

h4xxr
I made your suggested change, great idea, but it did not have any effect on my display. I think the problem has to do with the tabBarController. Probably 75 percent of the tabbar gets cut off at the bottom.
Bryan
A: 

I ended up creating the frame rect manually:

tabBarController.view.frame = CGRectMake(0,0,320,460);
Bryan