iOS開發 適配7系統和解決視圖高度一直爲480(即上下部分黑屏)

今天遇到了一個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;
    }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章