适配ios7

来源:互联网 发布:薪酬数据分析方法 编辑:程序博客网 时间:2024/06/04 17:54
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);
    }
 
0 0
原创粉丝点击