Can Poyrazoğlu
Can Poyrazoğlu

Reputation: 34780

Why is status bar messed up with translucent navigation bar

I am trying to make my status bar and translucent navigation bar "unified", which is the standard look in iOS 7 and above. However, I've got many navigation controllers, view controllers, and a tab bar controller, a view controller that owns all etc. and everything is messed up. Whatever I try, I can't get rid of this look:

enter image description here

The status bar doesn't "merge" with the navigation bar. The problem is not the color, it still doesn't merge when the status bar text is black. I've tried changing the view controller-based status bar setting to both values, no avail.

How can I make them merge?

UPDATE: I've got a very strange observation. I was trying everything I can about layout guides and constraints, and I've tried removing top layout guide code on viewWillAppear::

for (NSLayoutConstraint *constraint in self.view.constraints) {
    if(constraint.firstItem == self.topLayoutGuide && constraint.secondItem == nil){
        //constraint.constant = -20;
        [self.view removeConstraint:constraint];
        break;
    }
}

Suddenly, my status bar started to display perfectly as it should be, unified with the status bar. But no content inside my view controller is displayed now, so obviously, this isn't a solution. But it really seems to be something related to the top layout guide.

Upvotes: 0

Views: 381

Answers (1)

Can Poyrazoğlu
Can Poyrazoğlu

Reputation: 34780

I've just figured out everything. My "master" controller had everything embedded in an embedded view controller and it had it's top spacing to top layout guide "0". But, it was 20px down, so I changed the constraint to "-20". It seems a bit hacky but it just fixed everything and didn't mess anything up.

Upvotes: 1

Related Questions