使用 MPMediaPickerController 直接打开播放列表选项卡的可能性

发布于 2024-10-27 00:42:47 字数 794 浏览 0 评论 0 原文

我正在实现一个基本应用程序,它允许在应用程序中从音乐中选择播放列表。我做到了。但我的问题是它直接显示“音乐”选项卡。但根据我的要求,当用户进入该视图时,我需要显示播放列表选项卡。以下是我的代码,

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

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

I am implementing a basic application that which allows to select a play list from music with in the application. I make it. But my problem is it is showing directly Music tab directly. But as per my requirements I need to show the playlist tab when the user takes to that view. 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];

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暖风昔人 2024-11-03 00:42:47
-(IBAction)btnSelectSong:(id)sender
{

       MPMediaPickerController *picker =
        [[MPMediaPickerController alloc]
         initWithMediaTypes: MPMediaTypeAnyAudio];

        [picker setDelegate: self];
        [picker setAllowsPickingMultipleItems: YES];
        picker.prompt =
        NSLocalizedString (@"Add songs to play",
                           "Prompt in media item picker");

        [self presentModalViewController: picker animated: YES];

}
-(IBAction)btnSelectSong:(id)sender
{

       MPMediaPickerController *picker =
        [[MPMediaPickerController alloc]
         initWithMediaTypes: MPMediaTypeAnyAudio];

        [picker setDelegate: self];
        [picker setAllowsPickingMultipleItems: YES];
        picker.prompt =
        NSLocalizedString (@"Add songs to play",
                           "Prompt in media item picker");

        [self presentModalViewController: picker animated: YES];

}
南城追梦 2024-11-03 00:42:47

根据苹果的文档,在 MPMediaPickerController 的播放列表部分中打开是不可能的

,我已经在这里回答了:
您将需要使用媒体查询(按歌曲、艺术家等)来实现自己的选择器。

您将需要使用媒体查询(按歌曲、艺术家等)来实现自己的选择器。

我建议阅读: “使用 iPod 库”

以及更具体的内容:
MPMediaPlaylist 类参考

opening in the playlist section of MPMediaPickerController is not possible according to Apple's documentation

as already i answered here:
You will need to implement your own picker, using media queries (by song ,by artist, etc).

You will need to implement your own picker, using media queries (by song ,by artist, etc).

I suggest reading: “Using the iPod Library” in Apple's "iPod Library Access Programming Guide"

and more specific:
MPMediaPlaylist Class Ref

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文