0

UINavigationBar shows 2 Background Images on iPhone 4. One is in the middle. But one is Bigger and positioned in right side in UINavigationBar. I tested on iPhone 5 and it is not happening. Any advise please.

Please see image on

http://s27.postimg.org/5jvzqp04z/header.png

I am sorry I don't have enough reputation to post image in here.

Shaik Riyaz
  • 11,204
  • 7
  • 53
  • 70
pmp
  • 3
  • 3

1 Answers1

0

Try this:

navigationBar.translucent = NO;, It is YES by default in iOS7.

Kindly read this UINavigationBar documentation:

New behavior on iOS 7. Default is YES. You may force an opaque background by setting the property to NO. If the navigation bar has a custom background image, the default is inferred from the alpha values of the image—YES if it has any pixel with alpha < 1.0 If you send setTranslucent:YES to a bar with an opaque custom background image it will apply a system opacity less than 1.0 to the image. If you send setTranslucent:NO to a bar with a translucent custom background image it will provide an opaque background for the image using the bar's barTintColor if defined, or black for UIBarStyleBlack or white for UIBarStyleDefault if barTintColor is nil.

Setting 'navigationBar.translucent' value causes exception if you run project in devices/simulators having older iOS versions.

Add a version check like this:

 float systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
 if (systemVersion >= 7.0)
 {
navigationBar.translucent = NO;
 }

Another option would be to set this:

vc.edgesForExtendedLayout = UIRectEdgeNone;

Hopefully this will helps you. Cheers :)

Irfan
  • 4,301
  • 6
  • 29
  • 46
  • Thanks for the advise and sorry for late reply. I tried your code. But it does not seem to change. The problem occurs in on iPhone 4 and iPad but not on iPhone 5. It wired. I will add image of my problem. Hope to see more advise. – pmp Mar 14 '14 at 05:44
  • Yes sure add the image it will us to understand your scenario thoroughly. – Irfan Mar 14 '14 at 05:48
  • Kindly check these below links may it will help you : http://stackoverflow.com/questions/13814654/custom-uinavigationbar-works-on-simulator-but-not-on-released-version http://stackoverflow.com/questions/11886644/custom-styling-of-uinavigationbar-not-working-properly http://stackoverflow.com/questions/18990283/ios-7-navbar-colours-not-showing-properly-on-iphone-4 http://stackoverflow.com/questions/6851984/semitransparent-background-image-png24-for-uinavigationbar-only-shows-transpar – Irfan Mar 14 '14 at 05:54
  • I have tried everything and not worked. I guess it is because of iOS 7.1. Because Background image was working fine in iOS 7.0.6. It is not because of iPhone 4 or 5 or iPad but because of iOS version. Probably a bugs. I also found out that UITabbar Image tint colour could not change also (only blue colour). Coz it is a bug in iOS 7, I will vote your answer as solution. Thanks. – pmp Mar 14 '14 at 06:34