2011-03-29 90 views
0

我正在实现基于MPMediaPickerController的应用程序。在那当我试图打开音乐应用程序时,它需要带我到“播放列表”选项卡,而不是显示“音乐”选项卡。为此,我使用选定的索引属性来制作它。但仍然无效。以下是我的代码,请问你们能否帮助我,这很紧急。MPMediaPickerController选择的索引不起作用

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]; 

谢谢, 钱德拉。

回答

0

不幸的是,您不能设置MPMediaPickerController的选定索引。这不是常规的UITabBarController。如果你想改变选定的索引,颜色等,你必须将其子类化。抱歉。

查询http://bit.ly/krMNMK以获取更多参考。