Ios4 MPMediaPickerController所选索引不工作

Ios4 MPMediaPickerController所选索引不工作,ios4,mpmediapickercontroller,Ios4,Mpmediapickercontroller,我正在实现一个基于MPMediaPickerController的应用程序。在这种情况下,当我试图打开音乐应用程序时,它需要将我带到播放列表选项卡,而不是显示音乐选项卡。为此,我使用selected index属性来创建它。但它仍然不起作用 以下是我的代码: MPMediaPickerController *picker = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic]; pi

我正在实现一个基于MPMediaPickerController的应用程序。在这种情况下,当我试图打开音乐应用程序时,它需要将我带到播放列表选项卡,而不是显示音乐选项卡。为此,我使用selected index属性来创建它。但它仍然不起作用

以下是我的代码:

   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.selectedIndex=1;
    [picker.tabBarController.selectedViewController viewDidAppear:YES];

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

很遗憾,您无法设置MPMediaPickerController的选定索引。它不是一个普通的超级控制器。如果要更改选定的索引、颜色等,则必须对其进行子类化。对不起

查看更多参考资料