Display screen for iOS6 and iOS7 in simulator is different

前端 未结 4 1881
离开以前
离开以前 2020-12-18 16:20

\"enter

\"enter

4条回答
  •  失恋的感觉
    2020-12-18 17:08

    Add this code in your AppDelegate.m

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
        {
         //Whatever your code goes here
      if(kDeviceiPad){
    
         //adding status bar for IOS7 ipad
             if (IS_IOS7) {
                  UIView *addStatusBar = [[UIView alloc] init];
                  addStatusBar.frame = CGRectMake(0, 0, 1024, 20);
                  addStatusBar.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; //change this to match your navigation bar
                  [self.window.rootViewController.view addSubview:addStatusBar];
                        }
                    }
        else{
    
             //adding status bar for IOS7 iphone
            if (IS_IOS7) {
                UIView *addStatusBar = [[UIView alloc] init];
                addStatusBar.frame = CGRectMake(0, 0, 320, 20);
                addStatusBar.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1]; //You can give your own color pattern
                [self.window.rootViewController.view addSubview:addStatusBar];
            }
    
        return YES;
       }
    

提交回复
热议问题