Cocoa touch 为什么我的UtiAbbar在加载到肖像时会向下移动20像素?

Cocoa touch 为什么我的UtiAbbar在加载到肖像时会向下移动20像素?,cocoa-touch,ios,uinavigationcontroller,uitabbarcontroller,uitabbar,Cocoa Touch,Ios,Uinavigationcontroller,Uitabbarcontroller,Uitabbar,我正在UINavigationController内部加载uitabarcontroller。默认情况下,UITabBar控制器的UITabBar将其放置在视图的底部。通过使用默认选项,当应用程序在横向启动时,条形图将正确显示在底部位置 这也使得底部的纵向显示正确(但仅当应用程序以横向模式启动时)。 如果我在纵向上启动应用程序,它似乎会向下移动两个横向上状态栏的高度: 和肖像: 我正在尝试使用与CNBC应用程序类似的效果,并在视图顶部显示uitabar。回顾之后,我尝试自定义UITabB

我正在
UINavigationController
内部加载
uitabarcontroller
。默认情况下,
UITabBar控制器的
UITabBar
将其放置在视图的底部。通过使用默认选项,当应用程序在横向启动时,条形图将正确显示在底部位置

这也使得底部的纵向显示正确(但仅当应用程序以横向模式启动时)。

如果我在纵向上启动应用程序,它似乎会向下移动两个横向上状态栏的高度:

和肖像:

我正在尝试使用与CNBC应用程序类似的效果,并在视图顶部显示
uitabar
。回顾之后,我尝试自定义UITabBar

我只是添加了几行代码:

-(void)loadView{
    UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
    contentView.backgroundColor = [UIColor clearColor];
    self.view = contentView;
    [contentView release];

    orderingTabBarController = [[UITabBarController alloc] init];
    OrderingSpecialsViewController *specialsViewController = [[OrderingSpecialsViewController alloc] initWithNibName:@"OrderingSpecialsViewController" bundle:nil];
    OrderingProductViewTabBarController *productViewTabBarController = [[OrderingProductViewTabBarController alloc] init];
    OrderingSummaryViewController *summaryViewController = [[OrderingSummaryViewController alloc] init];

    specialsViewController.title = @"SPECIALS";
    productViewTabBarController.title = @"PRODUCT";
    summaryViewController.title = @"ORDER SUMMARY";

    [orderingTabBarController setViewControllers:[NSArray arrayWithObjects:specialsViewController, productViewTabBarController, summaryViewController, nil] animated:YES];
    orderingTabBarController.tabBar.frame = CGRectMake(0.0, 110.0, self.view.frame.size.width, 40.0);

    [specialsViewController release];
    [productViewTabBarController release];
    [summaryViewController release];

    [self.view addSubview:orderingTabBarController.view];
}
当我尝试修改UITabBar的框架时,它在横向模式下消失:

当它再次分别在横向和纵向中启动时,在纵向上出现在不同的高度

以横向模式启动:

以纵向模式启动:

以前有人遇到过这个问题吗?如果是,你是如何解决的?这里的任何帮助都将不胜感激


当视图以纵向模式加载时,它似乎只是添加了状态栏的20个像素,就好像它没有找到状态栏,即使它在那里,因此,它在状态栏已有的20个像素的基础上增加了20个像素。

我实际上通过IB解决了这个问题。视图控制器出于某种原因希望添加一个状态栏,您只需在IB上将其设置为“无”,然后选中“调整视图大小以适应”。另外,确保视图的尺寸设置为768 x 1024。

当视图未内置IB时,有人知道如何执行此操作吗?