MPMoviePlayerViewController vs. Appearance-Framework (iOS 5)

I am using MPMoviePlayerViewController inside my project. I defined the following view for UIButtons and UINavigationbar as follows:

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

So now MPMoviePlayerViewController also uses the navigation bar. The problem now: the button uses this appearance, but the toolbar doesn’t => it looks crappy. So now I have the following questions:

  • Can I convince the UINavigationBar of MPMoviePlayerViewController to use the look?
  • OR can completely remove the look of MPMoviePlayerViewController only.

I tried to access the button through playerViewController.navigationitem.leftbarbuttonitem and overwrite the properties, but this does not work.

It would be great if you could help me. Thanks.

+4
source share
1 answer

Have you tried setting appearanceWhenContainedIn for MPMoviePlayerViewController ? appearance and appearanceWhenContainedIn work simultaneously.

 [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navigationbarBackground"] forBarMetrics:UIBarMetricsDefault]; [[UINavigationBar appearanceWhenContainedIn:[MPMoviePlayerViewController class], nil] setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; 
+6
source

Source: https://habr.com/ru/post/1379560/


All Articles