2
votes

I want to use a different UINavigationBar when the iPhone is in landscape mode because of the reduced height. In my app delegate I have:

[[UINavigationBar appearance] setBackgroundImage:iPhoneToolbarImage forBarMetrics:UIBarMetricsLandscapePhone];

This does not change the appearance of the UINavigationBars at all, but this does:

[[UINavigationBar appearance] setBackgroundImage:iPhoneToolbarImage forBarMetrics:UIBarMetricsDefault];

The problem is that it uses the same image for both landscape and portrait, so it looks wrong in one orientation. It seems like the UIBarMetricsLandscapePhone parameter doesn't do anything at all.

I've tried using instance-specific code in the individual view controllers, with the same effect. Am I going to have to revert to manually changing it on every interface orientation? This doesn't allow me to set the correct background images on system views like the image picker.

is

1
You are setting the same image (iPhoneToolbarImage) for both orientation.Dinesh Raja

1 Answers

0
votes

I got it to work, it seems like the UIBarMetricsLandscapePhone setting is only respected if UIBarMetricsDefault is also set.

They both need to be present.