如何设置MPRemoteCommandCenter / MPNowPlayingInfoCenter以添加查找按钮?我要实现的结果在屏幕截图上。
ios - 如何在iOS锁定屏幕上添加查找按钮?-LMLPHP
我已经添加了以下代码:

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

最佳答案

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

10-08 06:13