【问题标题】:Hide MPRemoteCommand seekforward and seekbackward隐藏 MPRemoteCommand 向前搜索和向后搜索
【发布时间】:2016-05-23 03:37:53
【问题描述】:

我正在为我的学校开发一个简单的广播应用程序,因为它是一个流,我认为我们不需要 seekforward 和 seekrewind。我看到您可以更改这些按钮的含义,但我无法将其从命令中心/锁定屏幕中完全删除。这可能吗,还是我被无用的无用按钮卡住了?

【问题讨论】:

    标签: ios objective-c swift mpmediaplayercontroller


    【解决方案1】:

    我不确定我的回答是否对您有帮助,因为我不知道您是否将 AVPlayer 用于您的应用程序。 我将 AV Player 用于应用程序并以编程方式设置 CommandCenter。

    例如:

    func updateCommandCenter() {
      let commandCenter = MPRemoteCommandCenter.sharedCommandCenter()
    
      commandCenter.playCommand.addTarget(self, action:   #selector(MusicPlayerVC.playCurrentItem))
      commandCenter.pauseCommand.addTarget(self, action: #selector(MusicPlayerVC.pauseCurrentItem))
      commandCenter.togglePlayPauseCommand.addTarget(self, action: #selector(MusicPlayerVC.playPauseButtonPressed(_:)))
    
    //    commandCenter.skipForwardCommand.preferredIntervals = [15]
    //    commandCenter.skipForwardCommand.addTarget(self, action: #selector(MusicPlayerVC.forward(_:)))
    
      commandCenter.bookmarkCommand.addTarget(self, action: #selector(MusicPlayerVC.save(_:)))
    }
    

    我刚刚注释掉了skipForard,它就从主屏幕上消失了。因此,如果您将其放开,则不应显示。

    希望我能帮到你。

    截图:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多