2009-07-18 78 views
2

我在AppDelegate中,我使用:状态栏重叠的ViewController

ActivitiesViewController *acController = [[ActivitiesViewController alloc] initWithNibName:@"ActivitiesView" bundle:[NSBundle mainBundle]]; 

    UINavigationController *acNavController = [[UINavigationController alloc] initWithRootViewController:acController]; 

    [self.tabBarController setSelectedIndex:0];  
    [self.tabBarController setSelectedViewController:acNavController]; 

要切换的意见,我的TabBarController。其结果是靠近窗口顶部:

alt text http://img.skitch.com/20090718-tpgya2nt4yeadacgs54dh8syp2.png

如何让我的看法,以正确的位置?

Regards

回答

10

这是真正的答案。 之前的点(void)实际上是一个破折号。

- (void)viewWillAppear:(BOOL)animated { 
    // to fix the controller showing under the status bar 
    self.view.frame = [[UIScreen mainScreen] applicationFrame]; 
} 
+0

修复了你的格式。 ;)现在没有点了。 – BastiBen 2011-02-12 13:17:30

1

检查界面大小是如何在界面构建器或代码中定义的。确保它占用了分配给状态栏的20个像素,即高度不应超过460.

1

在界面构建器中,确保“状态栏”未设置为“模拟界面”下的“无”元素“在视图的属性中。

0

解决的办法是在旧的UINavigationViewController中加载UIViewController。这样UIViewController保持原来的位置。感谢您的帮助