1

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?

  • in iOS 7 navigation bar height is 64pts, use image with 64pts height to fit the view – Suhit Patil Nov 12 '13 at 11:51
  • I have rendered the status bar hidden and have set View controller-based status bar appearance to NO. Hence ,my navigation bar height is 44 px in iOS 7 as well. – swatiKaushik Nov 12 '13 at 12:33
  • in iOS 7 status bar resides over the naviagtionbar, even if you hide the status bar, height of the navigation bar remains same i.e. 64pts. Please refer ios7 transition guide https://developer.apple.com/library/ios/documentation/userexperience/conceptual/transitionguide/Bars.html#//apple_ref/doc/uid/TP40013174-CH8-SW1 – Suhit Patil Nov 12 '13 at 12:37
  • I wonder why the self.navigationController.navigationBar.frame.size.height is printing 44.0 in the log. – swatiKaushik Nov 12 '13 at 12:55
  • I had to set ShadowImage property explicitly for iOS7 as mentioned in the docs.Thanks everyone. – swatiKaushik Nov 12 '13 at 13:28

3 Answers3

1

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

Community
  • 1
  • 1
user1548843
  • 670
  • 12
  • 20
0

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.

Infinity James
  • 4,667
  • 5
  • 23
  • 36
0

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

Suhit Patil
  • 11,748
  • 3
  • 50
  • 60
  • HERE,https://developer.apple.com/library/ios/documentation/uikit/reference/UIBarPositioning_Protocol/Reference/Reference.html#//apple_ref/occ/intf/UIBarPositioning ,I read ,"Avoid using an extra-tall background image to display a custom drop shadow below the navigation bar. This technique won’t work in iOS 7"?!! That's what I am doing it seems. – swatiKaushik Nov 12 '13 at 13:01