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

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

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

How to change Status Bar text color in iOS

Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file. In the viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate]; Add the following method: – (UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleLightContent; } Note: This does not work for controllers inside UINavigationController, please see Tyson’s comment below 🙂 Swift 3 – This will work controllers inside UINavigationController. Add this code inside your … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)