如何在iOS锁屏上添加搜索按钮?

时间:2022-09-06 21:25:03

How to setup MPRemoteCommandCenter/MPNowPlayingInfoCenter to add seek buttons? Result that I want to achieve is on the screenshot. 如何在iOS锁屏上添加搜索按钮? I have already added this code:

如何设置MPRemoteCommandCenter / MPNowPlayingInfoCenter以添加搜索按钮?我想要实现的结果是截图。我已经添加了这段代码:

[[MPRemoteCommandCenter sharedCommandCenter].seekForwardCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
    [weakSelf rewindForward];

    return MPRemoteCommandHandlerStatusSuccess;
}];
[MPRemoteCommandCenter sharedCommandCenter].seekForwardCommand.enabled = YES;

[[MPRemoteCommandCenter sharedCommandCenter].seekBackwardCommand addTargetWithHandler:^MPRemoteCommandHandlerStatus(MPRemoteCommandEvent * _Nonnull event) {
    [weakSelf rewindBackward];

    return MPRemoteCommandHandlerStatusSuccess;
}];
[MPRemoteCommandCenter sharedCommandCenter].seekBackwardCommand.enabled = YES;

1 个解决方案

#1


1  

You would also need to set preferredIntervals as described in https://*.com/a/24818340/1514970.

您还需要按照https://*.com/a/24818340/1514970中的说明设置preferredIntervals。

#1


1  

You would also need to set preferredIntervals as described in https://*.com/a/24818340/1514970.

您还需要按照https://*.com/a/24818340/1514970中的说明设置preferredIntervals。