What are the iOS specifications / guidelines for navigation bar background images? - ios

Does anyone know the iOS image resolutions for navigation bar backgrounds? I’ve found the resolutions for pretty much all the other elements on Apple’s Custom Icon and Image Creation Guidelines page, but I couldn’t seem to find anything for pixel sizes requirements for navigation bar background images (both regular and retina).

The iOS navigation bar is 44 pixels tall and 320 pixels wide. On Retina displays, those numbers are double, at 88 pixels and 640 pixels respectively.

The navigation bar is 44 pixels tall. You can check the dimensions of any iOS UI element by creating one in interface builder and clicking on the size inspector (the ruler).

Note there is an issue I reported here. It seems you cannot set width and insets of a bar button item image on a navigation item from within IB size inspector nor programmatically, they simply have no effect. You can do so for a bar button item on the toolbar though. This seems to be a bug.
By the way here is the link to Apple Icon and Image Creation Guidelines.

Apple does not support api for setting background image of NavigationBar.
You can only set tintColor.
Or you can subclass and implement the - (void) drawRect:(CGRect)rect method.

Related

how to get the same size like navigation bar using custom view?

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;

iPhone X compatibility programmatically

I want to make my app compatible with iPhone X. I'm not using storyboard or xibs, just code. When I run my app on the simulator the view overlaps part of the status bar and the home bar at the bottom. Is there a way to programmatically adjust the view so that it fits within the bounds? Any help is appreciated.
I believe the answer you are looking for is called safeAreaInsets, which are basically insets that considers the position of the iphoneX exclusive UI components such as the navigation bar and the home bar.
You should adjust the sizes and constraints of your UI components according to the safe area as opposed to the screen, for and non iphoneX devices, it would be 0, which means it would be the same as adjusting according the the screen sizes instead.
The docs for it is at:
https://developer.apple.com/documentation/uikit/uiview/positioning_content_relative_to_the_safe_area

Iphone X Custom Navigation Support, Tab Bar Size

In my application I am using custom Navigation bar which loads from XIB,
As Iphone X has different Status Bar and Top Bar what are the changes need to make?
Or it will run normally?
Is status bar color is still relevant?
Also has changes for Tabbar?
If you were keeping navigation bar's height 64 in old devices then for iPhone x you can set that height to 145 as apple human interface guidelines said that it have 145 points of height for top bar!
And yes status bar color will also relevant I think!
Edit
According to Geoff Hackworth's post
I think 140 is for large navigation bar titles in iOS 11 and iPhone x !
and for normal it should be 88

Bottom Space Tab Bar iOS issue

I have added a tab bar controller. There is a thin white space left at the bottom below the tab bar in iOS7 and a black space in iOS6. Any idea what might be the problem?
Probably your icon size is not matching to the standard design pattern: *
According to the apple link icon image size should be *30x30 for Normal / 60x60. for Retina #2x *
and Here if you are using the static title into Image than it's not a great idea to embed the title of the tab into the image—you're going to have poor accessibility and localization results like that.

NavigationBar clipping background image in iOS7 ;ClipsToBound:NO not working

I have set a background image slightly bigger than the navigationBar.The image is 55px in height.[I want a banner looking image with ribbon at the bottom of nav bar]
It was working ok in iOS6.
But in iOS7, its getting clipped by itself.
I tried setting
[self.navigationController.navigationBar setClipsToBounds:NO];
It's still getting clipped.
Can't I have a bigger background image without getting clipped?
this is due to Ui navigation bar is 64 point in ios7 that why this create problem.
refer this link https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/Bars.html refer table 5-1 that is give you idea that for resizable image what are the change in new ios7
you can use UIBarPositioning propety to solve your problem not sure but that may help you
refer this link for more info related to UIBarPositioning
https://developer.apple.com/library/ios/documentation/uikit/reference/UIBarPositioning_Protocol/Reference/Reference.html#//apple_ref/occ/intfp/UIBarPositioning/barPosition
Edited
also try by set this flag
navigationBar.translucent = NO;
for more info refer this link
iOS 7 UINavigationBar - UIView layout issue
The image is not getting clipped, it is most probably just too small.
The UINavigationBar is 64 points in iOS 7, so the 55px image will be too small, especially considering the retina resolution where 128px would be needed.
set the delegate of your navigation bar to your view controller, and return UIBarPositionTopAttached in delegate method. return the position which you want to see
- (UIBarPosition)positionForBar:(id<UIBarPositioning>)bar
https://developer.apple.com/library/ios/documentation/uikit/reference/UIBarPositioning_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIBarPositioning

Resources