4

i am using a MPMoviePlayerViewController inside my Project. I have defined the following appearance for UIButtons and UINavigationbar like so:

[[UIBarButtonItem   appearanceWhenContainedIn:[UINavigationBar class], nil]   
                    setBackgroundImage:[UIImage imageNamed:@"woodenBarButton"] 
                    forState:UIControlStateNormal 
                    barMetrics:UIBarMetricsDefault];

[[UINavigationBar appearance]   setBackgroundImage:[UIImage imageNamed:@"navigationbarBackground"] 
                                forBarMetrics:UIBarMetricsDefault];

So now MPMoviePlayerViewController is also using a navigation bar. The problem is now: The button uses the given appearance but the toolbar not => it looks crappy. So now i have the following questions:

  1. Can i convince the UINavigationBar in MPMoviePlayerViewController to use the appearance?
  2. OR can is remove appearance completely only for the MPMoviePlayerViewController.

I tried to access the button via playerViewController.navigationitem.leftbarbuttonitem and overwrite properties but that doesn't work.

Would be great if you can help me. Thanks.

Saibot
  • 103
  • 4

1 Answers1

6

have you tried also setting appearanceWhenContainedIn for MPMoviePlayerViewController? appearance and appearanceWhenContainedIn works both at the same time.

[[UINavigationBar appearance]   setBackgroundImage:[UIImage imageNamed:@"navigationbarBackground"] 
                            forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearanceWhenContainedIn:[MPMoviePlayerViewController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault];
Buju
  • 1,546
  • 3
  • 16
  • 27
  • glad to be of help. please mark this answer as the correct answer (the checkmark) as it is common behavior on stackoverflow. thx – Buju Nov 15 '11 at 16:43
  • Used this technique to remove appearance customisations when presenting MFMessageComposeViewController also. thanks – jumponadoughnut Jun 06 '12 at 10:54