现在的位置: 首页 > 综合 > 正文

iOS开发 适配7系统和解决视图高度一直为480(即上下部分黑屏)

2014年09月29日 综合 ⁄ 共 901字 ⁄ 字号 评论关闭

今天遇到了一个D痛的问题,明明做好了适配,显示效果却一直存在视图高度一直为480(即上下部分黑屏)的问题,多方了解才发现就是一张图片的问题。原来是项目找不到启动动画的图片文件。 只要设置了就解决了。Mark! 下面是7系统适配代码:

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.window setBackgroundColor:[UIColor grayColor]];
    
    ViewController *tab=[[ViewController alloc]init];
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:tab];
    if( ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0))
    {
        [nav.navigationBar  setBarTintColor: [UIColor colorWithRed:0 green:144/255.0f blue:230/255.0f alpha:1]];
    }
    else
    {
        [nav.navigationBar setTintColor:[UIColor colorWithRed:0 green:144/255.0f blue:230/255.0f alpha:1]];
    }
    self.window.rootViewController = nav;
    [self.window makeKeyAndVisible];

 if( ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0)) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
        self.extendedLayoutIncludesOpaqueBars = NO;
        self.modalPresentationCapturesStatusBarAppearance = NO;
    }

抱歉!评论已关闭.