jskidd3
jskidd3

Reputation: 4783

Modal view status bar

enter image description here

I have created a modal segue which links from a view controller embedded in a navigation bar controller to a fresh new view controller which I have named "Search View Controller".

My problem is I can't seem to continue with the same red status bar as I had before. How can I change the status bar from white (nothing there) in the screenshot to red like the predecessor?

I have tried just simply adding a view with the red colour 20 pixels high which does work, but this hacky solution then creates problems when rotating to landscape.

Any ideas?

Upvotes: 0

Views: 1290

Answers (2)

Mehmet Emre Portakal
Mehmet Emre Portakal

Reputation: 1774

as an another approach try this;

  • Add an UINavigationController before your controller and set your controller as rootController.
  • target segue to navigationController
  • then hide your navigation bar if you want.

Upvotes: 1

Joey Clover
Joey Clover

Reputation: 776

It's a pretty common problem, really. The only thing that worked for me was the hack found here: http://blog.ijasoneverett.com/2013/09/ios-7-bugs-the-status-bar-and-modal-view-controllers/ which is slightly (but not much more) elegant :)

let fixItView = UIView()
fixItView.frame = CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, 20);
fixItView.backgroundColor = UIColor.redColor() // your colour
view.addSubview( fixItView )

That's the basic idea. Try adding that small 'fixItView' to your navigation bar.

Upvotes: 3

Related Questions