Luk*_*uke 9 objective-c ios mpnowplayinginfocenter
我的应用程序不支持回到以前的曲目,我想知道我是否可以告诉锁屏音乐控件隐藏他们的倒带/上一个曲目按钮.我使用它MPNowPlayingInfoCenter将该信息传递给锁定屏幕.
很简单的问题,可以吗?例如,仅显示"播放/暂停"和"向前跳转"?
Lys*_*gel 18
从iOS 7.1开始,有一种方法可以自定义锁定屏幕和命令中心(以及可能的许多其他附件)中可用的控件:MPRemoteCommandCenter.
关于您的问题,您可以执行以下操作:
[MPRemoteCommandCenter sharedCommandCenter].previousTrackCommand.enabled = NO;
[MPRemoteCommandCenter sharedCommandCenter].skipBackwardCommand.enabled = NO;
[MPRemoteCommandCenter sharedCommandCenter].seekBackwardCommand.enabled = NO;
// You must also register for any other command in order to take control
// of the command center, or else disabling other commands does not work.
// For example:
[MPRemoteCommandCenter sharedCommandCenter].playCommand.enabled = YES;
[[MPRemoteCommandCenter sharedCommandCenter].playCommand addTarget:self action:@selector(play)];
Run Code Online (Sandbox Code Playgroud)
有关MPRemoteCommandCenter的更多常规信息,请参阅此Stack Overflow答案.
过时的:
我认为简短的回答是否定的.文件说这个 -
"您无法直接控制显示哪些信息或其格式.您可以根据要提供给系统的信息设置正在播放的信息中心字典的值.系统或连接的附件处理信息以一致的方式显示给所有应用."
| 归档时间: |
|
| 查看次数: |
5666 次 |
| 最近记录: |