簡體   English   中英

從iOS鎖定屏幕在應用程序中自定義遠程事件處理

[英]Custom remote event handling in app from iOS lock screen

spotify如何處理自定義遠程事件? 目前在運行iOS 8.1.3的iPhone 6和Spotify版本2.4.0.1822上,當我打開spotify無線電時,我在鎖定屏幕上獲得以下控件。 我已經嘗試閱讀所有與遠程事件有關的文檔,我無法找到任何允許來自鎖定屏幕的自定義遠程事件的資源。

在此輸入圖像描述在此輸入圖像描述

也許這是通過MPRemoteCommandCenter實現的。 這是一個例子......

MPRemoteCommandCenter *remoteCommandCenter = [MPRemoteCommandCenter sharedCommandCenter];
[[remoteCommandCenter skipForwardCommand] addTarget:self action:@selector(skipForward)];
[[remoteCommandCenter togglePlayPauseCommand] addTarget:self action:@selector(togglePlayPause)];
[[remoteCommandCenter pauseCommand] addTarget:self action:@selector(pause)];
[[remoteCommandCenter likeCommand] addTarget:self action:@selector(like)];

實現此代碼,在您的應用上播放音樂,並鎖定您的iPhone。 您可能會看到自定義鎖定屏幕。

注意 - 菜單可以自定義標簽,但不能自定義圖標圖像和行數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM