gpt4 book ai didi

ios - UIEventSubtypeRemoteControlTogglePlayPause 什么都不做

转载 作者:可可西里 更新时间:2023-11-01 04:23:42 26 4
gpt4 key购买 nike

我有一个播放音乐的应用程序,想使用锁屏控制(播放/暂停)。使用 NSLog,我可以看到我的应用获得了按钮触发器,但没有获得 UIEventSubtypeRemoteControlTogglePlayPause。

这是我的一些代码:

- (void)viewDidLoad {
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}

- (BOOL)canBecomeFirstResponder {
return YES;
}

- (void)remoteControlReceivedWithEvent:(UIEvent *)receivedEvent
{
NSLog(@"REMOTE RECEIVE");
if (receivedEvent.type == UIEventTypeRemoteControl)
{
NSLog(@"received remote event");
switch (receivedEvent.subtype)
{
case UIEventSubtypeRemoteControlTogglePlayPause:
NSLog(@"toggle button received");
//[self togglePlayPauseTapped: nil];
break;
default:
break;
}
}

我从 NSLog 输出中得到“REMOTE RECEIVE”和“received remote event”,但不是...TogglePlayPause 中的行。

有什么想法吗?

最佳答案

使用案例

UIEventSubtypeRemoteControlPause

UIEventSubtypeRemoteControlPlay

适用于 iOS 7

关于ios - UIEventSubtypeRemoteControlTogglePlayPause 什么都不做,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19445913/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com