开发者

MPMediaPickerController selected index not working

I am implementing a MPMediaPickerController based application. In that When I tried to open music application it need to takes me to the "playlists" tab instead of showing "Music" tab. For this I used selected index property to make it. But still it doesn't work.

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];
    picker.tabBarController.se开发者_开发百科lectedIndex=1;
    [picker.tabBarController.selectedViewController viewDidAppear:YES];

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


You cannot set the selected index of a MPMediaPickerController unfortunately. It's not a regular UITabBarController. If you want to change the selected index, color, etc, you'll have to subclass it. Sorry.

Check http://bit.ly/krMNMK for more reference.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜