Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
真的很简单的问题:有没有办法判断用户是否双击他们的耳机遥控器来跳过曲目,或者他们是否按下了控制中心的跳过按钮,例如?
我意识到他们都使用RemoteControl UIEvent,但我想知道我是否能辨别。我想播放一点听觉“哔”声,就像 Spotify 在跳过或暂停时所做的那样,但仅限于通过耳机播放时。
RemoteControl
UIEvent
这可以做到吗?
该方法- remoteControlReceivedWithEvent:给出了UIEventatype和 asubtype属性。type当您按下耳机或锁屏上的按钮时,该属性会给出相同的结果。
- remoteControlReceivedWithEvent:
type
subtype
对我来说,没有办法区分事件,除非你想检查耳机是否插入设备,但这并不完美......