I’ve looked everywhere and I can’t seem to find a solution that works…
I’m developing an app that uses the MPMediaPickerController and creates a Modal view that allows the user to choose a song to play. My main view has a blackOpaque barStyle and I would like the Picker to have the same, but I cant seem to change the barStyle or color in anyway that I’ve tried. Here is the code snippet:
-(IBAction)showMediaBrowser:(id)sender {
// Create a MediaPickerController object (alloc) and initialize with ONLY music type media
mediaPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic];
// CK - Set properties
mediaPicker.delegate = self;
mediaPicker.prompt = @"Choose your song:";
mediaPicker.navigationController.toolbar.barStyle = UIBarStyleBlackOpaque;
// CK - Present the model view and animate
[self presentModalViewController:mediaPicker animated:YES]; }
Thanks
It’s possible (likely) that the media picker doesn’t have a navigation toolbar at the point in time that you are attempting to set the toolbar style. Have you checked to see that
mediaPicker.navigationControllerhas a value ?I’d recommend embedding the media picker controller into your own view hierarchy (the docs for MPMediaPickerController say it’s possible), and then you will have complete control over the navigation bar from your own view controller.