Styling in iOS 5: UINavigationController * if * in PopOver

I am setting my UINavigationController to a custom image, however this is pretty bad in Popover, is there a way to do this only for navigation controllers that are not in a popover?

I am currently doing this in my AppDelegate.m :

 - (void)applyCustomStyling{ [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"TitleBar.png"] forBarMetrics:UIBarMetricsDefault]; [[UIToolbar appearance] setBackgroundImage:[UIImage imageNamed:@"TitleBar.png"] forToolbarPosition:UIToolbarPositionAny barMetrics:UIBarMetricsDefault]; } 

So, if you do not believe this looks bad:

http://i.minus.com/joDeixTP7XLpl.png

Here's how it should be (UIPopover-default):

http://i.minus.com/i97ORJTj5pjZK.png

+4
source share
1 answer

You can use appearanceWhenContainedIn 1 for more granular control of appearance based on your controller hierarchy:

 [[UINavigationBar appearanceWhenContainedIn:[UIPopoverController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; 
+7
source

All Articles