我正在实现一个基于 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];