我正在实现一个基于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];发布于 2011-06-13 16:04:52
很遗憾,您不能设置MPMediaPickerController的选定索引。这不是一个普通的UITabBarController。如果你想改变所选的索引、颜色等,你必须将其子类化。抱歉的。
有关更多参考,请查看http://bit.ly/krMNMK。
https://stackoverflow.com/questions/5470872
复制相似问题