IOS7 Status bar hide/show on select controllers

The plist setting “View controller-based status bar appearance” only controls if a per-controller based setting should be applied on iOS 7. If you set this plist option to NO, you have to manually enable and disable the status bar like (as it was until iOS 6): [[UIApplication sharedApplication] setStatusBarHidden:YES] If you set this plist option … Read more

UIStatusBarStyle PreferredStatusBarStyle does not work on iOS 7

I discovered that if your ViewController is inside a navigationController then the navigationController’s navigationBar.barStyle determines the statusBarStyle. Setting your navigationBar’s barStyle to UIBarStyleBlackTranslucent will give white status bar text (ie. UIStatusBarStyleLightContent), and UIBarStyleDefault will give black status bar text (ie. UIStatusBarStyleDefault). Note that this applies even if you totally change the navigationBar’s color via its … Read more

How to prevent UINavigationBar from covering top of view in iOS 7?

Set the navigation bar’s translucent property to NO: self.navigationController.navigationBar.translucent = NO; This will fix the view from being framed underneath the navigation bar and status bar. If you have to show and hide the navigation bar, then use if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) self.edgesForExtendedLayout = UIRectEdgeNone; // iOS 7 specific in your viewDidLoad method.

Change Status Bar Background Color in Swift 3

extension UIApplication { var statusBarView: UIView? { if responds(to: Selector((“statusBar”))) { return value(forKey: “statusBar”) as? UIView } return nil } } UIApplication.shared.statusBarView?.backgroundColor = .red Update for iOS 13 App called -statusBar or -statusBarWindow on UIApplication: this code must be changed as there’s no longer a status bar or status bar window. Use the statusBarManager object … Read more

How to set Status Bar Style in Swift 3

[UPDATED] For Xcode 10+ & Swift 4.2+ This is the preferred method for iOS 7 and higher In your application’s Info.plist, set View controller-based status bar appearance to YES. Override preferredStatusBarStyle (Apple docs) in each of your view controllers. For example: override var preferredStatusBarStyle: UIStatusBarStyle { return .lightContent } If you have preferredStatusBarStyle returning a … Read more

preferredStatusBarStyle isn’t called

For anyone using a UINavigationController: The UINavigationController does not forward on preferredStatusBarStyle calls to its child view controllers. Instead it manages its own state – as it should, it is drawing at the top of the screen where the status bar lives and so should be responsible for it. Therefor implementing preferredStatusBarStyle in your VCs … Read more

iOS 7: UITableView shows under status bar

For anyone interested in replicating this, simply follow these steps: Create a new iOS project Open the main storyboard and delete the default/initial UIViewController Drag out a new UITableViewController from the Object Library Set it as the initial view controller Feed the table some test data If you follow the above steps, when you run … Read more