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

1.2k Views Asked by At

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?

3

There are 3 best solutions below

3
On

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.

0
On

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

1
On

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