2

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?

4

1 回答 1

0

这不是错误,如果您接听电话然后在通话仍处于活动状态时切换到您的应用程序,也会发生这种情况。

这是你需要的东西。在布局 UI 时要考虑到并确保当该栏恢复到正常大小时 UI 恢复到所需的状态,这是另一件需要注意的小事。

此外,如果您打开iChat ,您可以在模拟器上更轻松地进行测试- 我想现在您应该在 Mountain Lion 上使用 FaceTime 应用程序,由于“活动呼叫”,这应该将顶部栏设置为绿色,我试图摆脱这对于模拟器来说是徒劳的,因为我正在开会和开发这导致了一个问题,但是一个很好的问题,因为我随后正确地布置了我的 UI。

于 2012-08-10T20:05:35.463 回答