iphone-sdk-3.0mpmediapickercontroller

possibilities to open playlist tab directly by using MPMediaPickerController


I am implementing a basic application that which allows to select a play list from music with in the application. I make it. But my problem is it is showing directly Music tab directly. But as per my requirements I need to show the playlist tab when the user takes to that view. Following is my code,

   MPMediaPickerController *picker =
    [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];

    picker.delegate                     = self;
    picker.allowsPickingMultipleItems   = YES;
    picker.prompt                       = NSLocalizedString (@"Select any song from the list", @"Prompt to user to choose some songs to play");

    // The media item picker uses the default UI style, so it needs a default-style
    //      status bar to match it visually
    [[UIApplication sharedApplication] setStatusBarStyle: UIStatusBarStyleDefault animated: YES];

    [self presentModalViewController: picker animated: YES];
    [picker release];

Solution

  • -(IBAction)btnSelectSong:(id)sender
    {
    
           MPMediaPickerController *picker =
            [[MPMediaPickerController alloc]
             initWithMediaTypes: MPMediaTypeAnyAudio];
    
            [picker setDelegate: self];
            [picker setAllowsPickingMultipleItems: YES];
            picker.prompt =
            NSLocalizedString (@"Add songs to play",
                               "Prompt in media item picker");
    
            [self presentModalViewController: picker animated: YES];
    
    }