適配ios7

xcode升級到Xcode5 在ios7運行 程序的狀態欄StatusBar消失了,現在有解決辦法了 1.在appdeletage裏面 添加如下代碼: if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20); } 2.在info.plist文件裏面 屬性:View controller-based status bar appearance 值設爲NO 接着運行程序,可以看到StatusBar了 



if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
    [application setStatusBarStyle:UIStatusBarStyleLightContent];
    self.window.clipsToBounds =YES;
    self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);

    //Added on 19th Sep 2013
    self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);
}


第一步 在項目的Info.plist 文件中 添加一行屬性配置
View controller-based status bar appearance =NO
這個設置爲:View Controller 不對status Bar 顯示進行操作

?
1
2
3
4
5
6
7
8
9
10
11
12
13
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
 self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
     
     
     
    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {          
     [application setStatusBarStyle:UIStatusBarStyleLightContent];            
    self.window.clipsToBounds =YES;              
  self.window.frame =  CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
        //added on 19th Sep
        self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);
    }
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章