如何使我的应用程序的控制中心上的下一个和上一个音轨按钮消失?

Zin*_*ing 6 iphone remote-control audio-player mpmusicplayercontroller ios

我正在制作一个处理音乐播放和暂停的iPhone音乐应用程序并维护自己的播放列表.此应用程序不提供next/prev歌曲功能,因此我不希望这些按钮显示在iOS的控制中心(向上滑动屏幕)上.

我尝试了以下代码,使它们从那里消失:

MPRemoteCommandCenter *commandCenter = [MPRemoteCommandCenter sharedCommandCenter];

// Do not allow next/prev song command on remote control since this is not supported in app either
commandCenter.nextTrackCommand.enabled = NO;
commandCenter.previousTrackCommand.enabled = NO;
[commandCenter.nextTrackCommand addTarget:self action: @selector(emptyFunction)];
[commandCenter.previousTrackCommand addTarget:self action: @selector(emptyFunction)];
Run Code Online (Sandbox Code Playgroud)

这不起作用:应用程序的音乐是否正在播放,这两个按钮仍然显示在上滑屏幕中,并且它们不会显示为灰色,并且它们确实起作用(虽然不正确,但这是无关的).

我应该如何让它们消失?