iOS 7 status bar back to iOS 6 default style in iPhone app?

前端 未结 25 858
终归单人心
终归单人心 2020-11-22 05:48

In iOS 7 the UIStatusBar has been designed in a way that it merges with the view like this:

\"GUI

25条回答
  •  终归单人心
    2020-11-22 06:27

    I am late for this Answer, but i just want to share what i did, which is basically the easiest solution

    First of all-> Go to your info.plist File and add Status Bar Style->Transparent Black Style(Alpha of 0.5)

    Now ,here it Goes:-

    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;
       }
    

提交回复
热议问题