簡體   English   中英

自定義iOS 10中的通知選項

[英]Customize the notification options in iOS 10

在iOS 9中的通知,我們可以使用(UIUserNotificationActionContext.Minimal)在通知托盤中自定義通知動作。 此API在iOS 10中已棄用。

在此處輸入圖片說明

現在,在iOS 10中,我看到通知動作為“查看”和“清除”。 有什么方法可以將這些默認操作更改為貪睡,刪除等操作?

您可以為此使用類別,以便自定義自己的操作。 請參閱Apple Docs

一些示例代碼-

UNNotificationAction* stopAction = [UNNotificationAction
  actionWithIdentifier:@"STOP_ACTION"
  title:@"Stop"
  options:UNNotificationActionOptionForeground];

// Create the category with the custom actions.
UNNotificationCategory* expiredCategory = [UNNotificationCategory
  categoryWithIdentifier:@"TIMER_EXPIRED"
  actions:@[stopAction]
  intentIdentifiers:@[]
  options:UNNotificationCategoryOptionNone];

暫無
暫無

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

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