2015-11-04 59 views
0

我想開發與imessage類似的交互式通知。我閱讀文檔,我嘗試添加多個UIMutableUserNotificationAction到UIMutableUserNotificationCategory並顯示它。我想像iMessage一樣顯示文本字段。這是我的問題如何在iOS交互式通知中添加文本字段

UIMutableUserNotificationCategory *notificationCategory = [[UIMutableUserNotificationCategory alloc] init]; 
notificationCategory.identifier = @"Email"; 
[notificationCategory setActions:@[notificationAction1,notificationAction2,notificationAction3] forContext:UIUserNotificationActionContextDefault]; 
[notificationCategory setActions:@[notificationAction1,notificationAction2] forContext:UIUserNotificationActionContextMinimal]; 

請幫助

+3

重複的問題和回答:http://stackoverflow.com/questions/25841227/adding-text-field-in-remote-notificaton-ios- 8 – Flipper

+0

謝謝@Flipper。像魅力一樣工作。 – sanjayzed

回答

0
let replyAction = UIMutableUserNotificationAction() 
replyAction.identifier = "REPLY_ACTION" 
replyAction.title = "Reply" 
replyAction.activationMode = UIUserNotificationActivationMode.Background 
replyAction.authenticationRequired = false  
replyAction.destructive = false 
//Set behaviour to .TextInput  
replyAction.behavior = .TextInput 
+0

請解釋您的代碼如何解決問題。 –

相關問題