Dipti Y W
Dipti Y W

Reputation: 474

StatusBar background color in iOS7

Im working on a app compatible from ios6 onwards. in iOS 7 status bar is overlapping views and navigationbar. i want status bar in iOS 6 style. like it should appear above all UI objects, views,Viewcontroller and navigation controller. how can we achieve this?

Upvotes: 0

Views: 505

Answers (2)

Vizllx
Vizllx

Reputation: 9246

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

Upvotes: 1

RAJA
RAJA

Reputation: 1214

For fixing the overlapping issue just try this link Status bar and navigation bar issue in IOS7

and for using status bar style similar to ios 6 this link may help you Change StatusBar style

In your app delegate's applicationDidFinishLaunching method:

[[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleBlackTranslucent];

Set UIStatusBarStyleBlackTranslucent/UIStatusBarStyleBlackOpaque for getting status bar similar to iOS6.

Hope this may help you

Upvotes: 1

Related Questions