Is it possible to hide all the controls when screen is locked? - objective c

戏子无情 提交于 2019-12-31 05:26:06

问题


I want to hide all the controls on the locked screen when an app is playing in the background. However, I want the audio related information to be displayed all the time.

I read about MPRemoteCommandCenter but we can't implement the below code because when you try to disable all then the screen starts showing 3 controls (toggle button, next track, previous track)

MPRemoteCommandCenter *rcc = [MPRemoteCommandCenter sharedCommandCenter];
[[rcc skipForwardCommand] setEnabled:NO];
[[rcc skipBackwardCommand] setEnabled:NO];
[[rcc nextTrackCommand] setEnabled:NO];
[[rcc previousTrackCommand] setEnabled:NO];
[[rcc skipForwardCommand] setEnabled:NO];
[[rcc skipBackwardCommand] setEnabled:NO];
rcc.playCommand.enabled = NO;
rcc.pauseCommand.enabled = NO;

Is there any other way to achieve what I am expecting? Currently play pause button is visible.

EDIT: My question is not a duplicate of How to disable all the MPRemoteCommand objects from MPRemoteCommandCenter because I want to hide. The answer given on the other question disables the controls.

来源:https://stackoverflow.com/questions/43995801/is-it-possible-to-hide-all-the-controls-when-screen-is-locked-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!