-1

I am having some trouble changing the navigation bar of the MPMediaPickerController. I understand that the Apple Documentation says that:

This class does support subclassing. The view hierarchy for this class is private; do not modify the view hierarchy.

Does this mean that in iOS 7 we are stuck with a black transparent bar style? Does it not support different Navigation Bar styles or a different background image?

I have tried some simple changes to the pickers navigation controller with no avail:

MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
picker.delegate = self;
UIImage* bgImage = [[UIImage imageNamed: @"header" ] imageWithRenderingMode: UIImageRenderingModeAlwaysOriginal];
[picker.navigationController.navigationBar setBackgroundImage: bgImage forBarMetrics: UIBarMetricsDefault];
[picker.navigationController.navigationBar setBarStyle: UIBarStyleBlackOpaque];
[self presentViewController: picker animated: YES completion: nil];

Additionally, the changes made to the applications Navigation bar appearance proxy does not seem to propigate to the media picker either..

Any thoughts?

Thanks!

Glavid
  • 1,071
  • 9
  • 19
  • 2
    I was unable to find what I was looking for. There are answers such as ones suggesting to create a catagory for all of your applications UINavigationBars, but this seems like a hack/work-around from the apple recommended appearance proxies that don't seem to be propagating to the MPMediaPickerController. I was unable to find any "best practice" type solution in other questions which leads me to believe that we are indeed "stuck with the black transparent style" in lieu of making a very "hacky" change – Glavid May 13 '14 at 17:27
  • 1
    You are correct about that. This thing is not legitimately customizable. So what are you asking? What more are you looking for? – matt May 13 '14 at 18:27
  • 1
    This answers my question.. "It is not legitimately customizable". Not sure why all of your answers seem to contain so much animosity, but I will try and be more specific with my questions in the future. Thanks – Glavid May 13 '14 at 21:23
  • So what ? I cant change background of presented navigation bar of MPMediaPickerController ? But now I have white background and white text so there should be some way to fix this... – Renetik Dec 05 '15 at 17:14

3 Answers3

0

Try this:

MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
picker.delegate = self;
UIImage* bgImage = [[UIImage imageNamed: @"header" ] imageWithRenderingMode:                  UIImageRenderingModeAlwaysOriginal];
[picker.navigationController.navigationBar setBackgroundImage: bgImage forBarMetrics: UIBarMetricsDefault];
[picker.navigationController.navigationBar setBarStyle: UIBarStyleBlackOpaque];
[self presentViewController: picker animated: YES completion: ^{
  //my comment : when this view appears, set status bar style you want here 
  [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
}];
nmh
  • 2,497
  • 1
  • 15
  • 27
  • Unfortunately I am not concerned about the status bar style, but rather the navigation bar style. That being said, moving the [setBarStyle:] call to the presentViewController completion block does not work or change the appearance of the Media pickers nav bar – Glavid May 14 '14 at 17:57
0

This worked for me. In AppDelegates, didFinishLaunchingWithOptions, add the following lines.

Swift:

UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]
UINavigationBar.appearance().barTintColor = Config.PURPLE_APP_COLOR
UINavigationBar.appearance().barStyle = .Black

Objective C:

[UINavigationBar appearance].setTitleTextAttributes = [NSForegroundColorAttributeName : [UIColor whiteColor]
[UINavigationBar appearance].barTintColor = [UIColor blueColor]
[UINavigationBar appearance].barStyle = UIBarStyleBlack
Muhammad Ibrahim
  • 1,923
  • 2
  • 15
  • 13
0

The behavior of tintColor for bars has changed on iOS 7.0. It no longer affects the bar's background and behaves as described for the tintColor property added to UIView.To tint the bar's background, please use -barTintColor.

imagePicker.navigationBar.barTintColor = [uicolor YourColor];