如何在iOS交互式通知中添加文本字段

时间:2015-11-04 08:38:30

标签: ios ios8 notifications ios9 uilocalnotification

我想像imessage一样开发交互式通知。我阅读文档,我尝试将多个UIMutableUserNotificationAction添加到UIMutableUserNotificationCategory并显示它。我想像iMessage一样显示文本字段。这是我的问题

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

请帮助

1 个答案:

答案 0 :(得分: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