关于 ios4. 系统的statusbar 隐藏后顶部出现横条问题


在进入全屏模式的时候,顶部的statusbar 进行了隐藏,但是顶部任然有一个20像素的横条;

测试过程中仅仅在ios 4中会出现这种问题,在网上搜索到的很多答案都是采用, xx-Info.plist 里面加入


然后在需要加载statusbar的地方加入

[[UIApplication sharedApplication] setStatusBarHidden:NO];

来解决问题,但是这种方法无法从根本解决这个问题。

经过分析,在viewController的底部采用的是一个 UINavigationViewContrller,而这里采用的是直接从控件列表拖拽到IB设计的地方;然后与mainVIewController进行关联。

而在采用纯代码去实现这一个过程后重新测试时,上面的蓝色横条消失了,如此经过测试可以发现这应该是系统的bug,所以建议还是采用纯代码的方式实现这一个过程,不要直接拖拽UINavigatiopnViewController;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    // Override point for customization after application launch.
    self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];
    UINavigationController *navigation = [[[UINavigationController alloc]initWithRootViewController:self.viewController] autorelease];

    [navigation setNavigationBarHidden:YES animated:NO];
    self.window.rootViewController = navigation;
    [self.window makeKeyAndVisible];
    return YES;
}





posted @ 2013-01-17 15:22  沙影无痕  阅读(182)  评论(0编辑  收藏  举报