Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7 status bar like iOS 6

I have an app with a support landscape and portrait mode. And I need the same behavior status bar like on iOS 6. What is the simplest way to do this?

I've tried the solutions in Stack Overflow question iOS 7 status bar back to iOS 6 style?, but it doesn't work. My subview depend on the view size, and my view doesn't stretch correctly. I don't want to update my XIB files; I simply want to add something that helps me. I don't know what it may be (hack or prayers).

like image 788
Gralex Avatar asked Sep 20 '13 12:09

Gralex


People also ask

Where is the status bar on iPhone 7?

Similar to the Mac's menu bar, iOS has a status bar at the top of the screen that contains symbols with useful information about your iPhone or iPad. With just a quick glance, you can view which settings are enabled on your device, the strength of your cellular connection and more.


2 Answers

You can try writing this in your ViewWillappear or DidAppear. Here we are shifting the view frame 20 pixels down.

CGRect frame = self.view.frame;
frame.origin.y = 20;

if (self.view.frame.size.height == 1024 || 
    self.view.frame.size.height == 768)
{
    frame.size.height -= 20;
}

self.view.frame = frame;

This will work, but however this is not a very good idea. You can also change the text colour of the status bar to light or dark depending on your app background by calling the following method if it helps.

-(UIStatusBarStyle)preferredStatusBarStyle
{
     return UIStatusBarStyleLightContent; // For light status bar

     return UIStatusBarStyleDefault // For Dark status bar
}
like image 144
Bhumit Mehta Avatar answered Oct 12 '22 18:10

Bhumit Mehta


If you are on Xcode 5 and you are installing in iOS 7 then sorry, this will not happen (as far as I know).

If you want to see the status bar on iOS 7 like iOS 6 than open your project in Xcode 4.x.x and install in iOS 7. One problem with this approach I found is that sometimes Xcode 4.x.x doesn't recognise an iOS 7 device.

But if your Xcode 4.x.x can show your iOS 7 device then it will work.

The .api generated from Xcode 4.x.x will work in both iOS 6 and iOS 7, but you will not get extra space (of the status bar) on iOS 7 and the new look of keyboard, picker, switch, etc. But yes, you will get the new UIAlertView (I don't know why this is new and the other controls are old.)

I hope we will soon get a better solution in Xcode 5 for this.

UPDATE:

I found the way to run the app from Xcode 5 as Xcode 4. This is just matter of the base SDK. If you want to built as Xcode 4 (iOS 6 SDK) from Xcode 5 then do the following.

  1. Close Xcode 4 and 5.

  2. In Xcode 4 Go to

    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs

  3. Here you will find iPhoneOS6.1.sdk. Copy this folder. And now go in Xcode 5 on the same path. In Xcode 5, you will find iPhoneOS7.0.sdk. Paste iPhoneOS6.1.sdk with it.

  4. Now close the Finder and launch Xcode 5. Go to project target setting -> Build Setting and find Base SDK. Select iOS 6.1 as Base SDK. This will also work for 6.0. You just need to find iPhoneOS6.0.sdk.

  5. Now you will see the device name twice in the run dropdown box. One for SDK 7.0 and one for SDK 6.1. So now you can run both ways with iOS 6 SDK and iOS 7 SDK.

I hope this will help someone.

like image 28
CRDave Avatar answered Oct 12 '22 19:10

CRDave