I have a custom navigation bar that worked well until iOS 11. It appears smaller than it should and seems to ignore the status bar height or something.
I set the whole thing programmatically and the height is set to 64.
have you tried to disable (untick) safe area?
Related
I need to recreate navigation bar using custom view, since it will be easier to make than inserting view to the actual navigation bar from apple.
I need to insert search bar and some buttons.
but I have problem to set the size of that custom navigation bar view, in some iOS device it seems little bit bigger than the navigation bar from apple, I set the autolayout like the picture below. constraint to leading, trailing and top to the superview and then set the aspect ration to 375:80
the custom view is the red one. the navigation bar in orangeVC is from apple using navigation controller
and here is the result, for iPhone XR, XSMax, it seems great, the size seems the same.
but for iPhone 8 it seems the custom view is slightly bigger
how to properly make custom view that has the same size like navigation bar from apple?
Where the ratio 375:80 are you getting from?
It's not correctly.
NavigationBar's height is 44 by default, and StatusBar is 44 for Notch type devices like iPhone X, XR, XS, XS Max and 20 in otherwise.
So you need to set 88 for Notch type devices and 64 for otherwise instead of ratio. Good luck!
Nothing needs to be calculated.
Navbar height should be 44.0 all the time.
But, Navbar top constraint should use Safe Area in place of superview. and add a status bar background view just to match your header color
The best approach I found so far, without having to create a navigation controller instance:
[self.navigationBar sizeThatFits:CGSizeZero].height;
I want to make a navigation bar that changes height in it's detail view just like the messages app in iOS 10. How can I do that?
Edit:
I am looking to change the height dynamically. SizeThatFits() Permanently changes the height.
If you are trying to do something else that requires the navigation bar to be resized, that's not supported. iOS 11 and Above
Community bug reports
I have a UIViewController subclass which when I run the app on iOS 7, the status bar shows on top of my view. Is there a way to avoid this? I do not want the status bar to be hidden. Is there a way to show the status bar above my app. I present my view using presentViewController. Please guide what I am missing?
In Xcode, In storyboard there is an option of iOS6/7 delta. set delta Y to 20 pixel of your view, to make compatible with iOS7.For this you have to disable auto layout, you can use auto resizing.
This is quite common issue. Starting from iOS 7 Status Bar is a part of the controller's view. Apple even have added special attribute of UIView in the Interface Builder: iOS 6/7 Deltas. To fix your problem and make your view look the same in different iOS versions, go to Size inspector and set Delta Y to 20.0.
I've got a background for the project that I am working on, which includes a 20px coloured bar for the top of an iOS 7 device.
This worked fine without autolayout, setting a 20px delta in storyboard. But now I can't do that, and I am stuck with constraints - which I cannot set on a per-OS basis.
Whatever I do, I seem to end up with the version on iOS 7 being 20px higher than on ios 6... Something I need to rectify, as I also have a bar under that status bar which is coloured for a navigation controller.
I've attached the background image - if I need to modify it to work with autolayout, I'm happy to do that.
There is a "top layout guide" object in your view hierarchy. If you build vertical constraints based on that, they pin to the top of the window if there is no status bar, or under the status bar otherwise. Use that.
I developed a simple app for iOS6 and now I'm to updating its appearence for iOS7. One of the first changes I would like to do concerns the navigation bar.
I'm using the standard navigation bar UI component that comes with xcode. While in iOS6 the navigation bar was clearly placed under the status bar (i.e. battery, carrier and hour), in iOS7 the navigation bar blends with the status bar.
My question is: how can I increase the height of the navigation bar and place the title vertically a little lower than the default position?
Currently I have this:
And the title is too close to the time. I would like to achieve this (standard Photos app that comes with iOS7):
here the title of the bar is lower and the bar is larger (or is just shifted down).
It have been trying to modify the height of the navigation bar through the size inspector but with no success.
It's probaly a very easy issue to solve, however I'm still new to xcode development and I can't figure it out.
Stick the view controller in a Navigation Controller, that should immediately solve the problem