4

我不知道如何切换播放和暂停按钮。我已经尝试过 TogglePlayPauseCommand。但它不起作用。

4

1 回答 1

2

您能否发布有关如何尝试实现 TogglePlayPauseCommand 的代码?我认为它会这样做:

public override void ViewDidLoad()
{
    base.ViewDidLoad ();
    var commandCenter = MPRemoteCommandCenter.Shared;
    commandCenter.TogglePlayPauseCommand.AddTarget (ToggledPlayPauseButton);
}

public MPRemoteCommandHandlerStatus ToggledPlayPauseButton(MPRemoteCommandEvent commandEvent)
{
     Console.WriteLine ("Toggled");
    return MPRemoteCommandHandlerStatus.Success;
}
于 2015-08-27T10:07:20.453 回答