I'm writing application for iOS 4.1+ and I had to add tab bar to view controller programmatically.
Here is the code of main ViewController:
- (void)viewDidLoad
{
FirstViewVC* vc1 = [[FirstViewVC alloc] init];
vc1.tabBarItem.title = @"Tab 1";
AboutVC* vc2 = [[AboutVC alloc] init];
vc2.tabBarItem.title = @"About Program";
NSArray* controllers = [NSArray arrayWithObjects:vc1,vc2, nil];
tabBarController.viewControllers = controllers;
self.tabBarController.view.frame = [[self view] frame];
tabBarController.view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight;
self.view.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:tabBarController.view];
(...) //deallocs
}
The result looks like this:
http://img152.imageshack.us/img152/5176/nohotspotup.png
Now, if I turn on personal hotspot, everything is sliding down:
http://img528.imageshack.us/img528/9348/img0028y.png
As you can see tabbar is cut off. I've tried many ways of applying resize masks and adding tabbar, but I still can't manage to get this working properly.
Is there a way to fix this?