rdurand
rdurand

Reputation: 7410

White pixels around custom navigation bar image

In my iOS 5+ app, I use a custom navigation bar image, with custom navbar buttons.

First of all, here is how I tell my app to use the images :

In AppDelegate.m :

UIImage *navBarImage = [UIImage imageNamed:@"Navbar"];
[[UINavigationBar appearance] setBackgroundImage:navBarImage forBarMetrics:UIBarMetricsDefault];

UIImage *barButton = [[UIImage imageNamed:@"Nav-button"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 6, 0, 6)];
[[UIBarButtonItem appearance] setBackgroundImage:barButton forState:UIControlStateNormal
                                      barMetrics:UIBarMetricsDefault];

So, the images are used. Great. But, there are a couple of things happening :

• First, on my button, under the bottom corners, au few white pixels appear (they're not on the original image, that's for sure). I also use a custom back button, and same thing happens. This seems to be more visible under iOS 6 than iOS 5.

• When I open a modal VC, the navigation bar is "filled up to the status bar" with white pixels. Only for a modal VC.

Here are screenshots of the situation.

iOS 5 - Main

iOS 5 , main VC.

iOS 5 - Modal

iOS 5, modal VC.

iOS 6 - Main

iOS 6, main VC.

iOS 6 - Modal

iOS 6, modal VC.

So, what can I do ? The white pixels under the buttons are not highly visible (a bit more for the back button), but I really want a nice design for the app, and this doesn't contribute at all..

Concerning the modal VC, I can use a "rectangle" image, which could cover the white pixels, but again, regarding design consistency, I'd prefer to use only one navigation bar..

As always, any explanation / solution / hint is greatly appreciated ! ;)

Thanks.


EDIT :

I just noticed that under iOS 6, the white pixels on top of the navigation bar are rounded, as the navigation bars in iOS 6.. Strange.. :)

Upvotes: 2

Views: 644

Answers (1)

Nenad M
Nenad M

Reputation: 3055

Hm! just for testing purpose, can you download the following sample image for a navigation bar background and try this image instead? Just let us now how it looks with this image.

I'm just guessing, but i suppose your image is not pixel perfect for the navigation bar dimensions! Probably a few pixels below the optimum height for the navigation bar.

Upvotes: 1

Related Questions