ios - 从 iOS 锁定屏幕在应用程序中自定义远程事件处理

标签 ios objective-c cocoa-touch uikit uiresponder

Spotify 如何处理自定义远程事件?目前在运行 iOS 8.1.3 和 spotify 版本 2.4.0.1822 的 iPhone 6 上,当我打开 spotify radio 时,我会在锁定屏幕上获得以下控件。我试过阅读所有与远程事件有关的文档,但我找不到任何允许从锁定屏幕自定义远程事件的资源。

enter image description here enter image description here

最佳答案

也许这是通过 MPRemoteCommandCenter 实现的。 这是示例...

MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[[remoteCommandCenter skipForwardCommand] addTarget:self action:@selector(skipForward)];
[[remoteCommandCenter togglePlayPauseCommand] addTarget:self action:@selector(togglePlayPause)];
[[remoteCommandCenter pauseCommand] addTarget:self action:@selector(pause)];
[[remoteCommandCenter likeCommand] addTarget:self action:@selector(like)];

执行此代码,在您的应用程序上播放音乐,并锁定您的 iPhone。您可能会看到一个自定义的锁定屏幕。

注意 - 菜单可以自定义标签,但不能自定义图标图片和行数。

关于ios - 从 iOS 锁定屏幕在应用程序中自定义远程事件处理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28677791/

相关文章:

ios - 是否可以为不同地区的iOS应用上传不同的元数据(应用信息,屏幕截图)

ios - 在iOS Simulator XCode上自动重新部署

Objective-C SSL同步连接

iphone - 将字符串 Url 与字符串值进行比较

ios - AVPlayer 中的视频不会以与播放器本身相同的速率改变大小

ios - 将 JSON 输出存储在 NSArray 中

ios - UISplitViewController 和取消选择单元格

ios - 模块名称前缀应该已被 native 端剥离,但不适用于 RCTJSCExecutor

ios - 由于 UIWebView API 已弃用,无法在 Appstore 上发布。如何正确迁移到WKWebView?

objective-c - 使用网桥从 .framework 导入文件时出错