MPMediaPickerController 在一个视图中,MPMediaPlayback 在另一个视图中。怎样做?
基本上我有一个三视图堆栈。在最后一个视图中,我得到了一个 MPMediaPickerController,它允许用户从他/她的库中选择一首歌曲。该歌曲将在稍后从第一个视图播放。我如何告诉玩家(在第一个视图中)应该玩什么?
一种可能性是发送通知并包含 MPMediaItemCollection 作为对象?
这是正确的方法还是您有其他更明智的建议?
Basically I have a three view stack. In the last view I got a MPMediaPickerController that lets the user pick a song from his/her library. The song is to be played later from the first view. How can I tell the player (in the first view) what should be played?
One possibility would be to send a notification and include the MPMediaItemCollection as the object maybe?
Is this a/the correct way or do you have other smarter suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我最终使用 NSNotification 并将 MediaItemCollection 附加为 userInfo。
I ended up using NSNotification and attaching the MediaItemCollection as userInfo.
使用 MPMediaPickerController 委托:
在第三个视图控制器中将 MPMediaPickerController 委托设置为您的第一个视图。在您的第一个视图控制器中实现委托回调函数。
Use the MPMediaPickerController delegate:
in your third view controller set the MPMediaPickerController delegate to be your first view. Implement the delegate callback functions in your first view controller.