在远程通知中添加文本字段,iOS 8 [英] Adding text field in Remote Notification, iOS 8

查看:137
本文介绍了在远程通知中添加文本字段,iOS 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的iOS应用程序中添加工具,用户可以直接从推送通知回复我的消息。就像iMessage应用程序在iOS 8中做的那样。我可以添加按钮来推送通知,但没有找到任何关于如何添加文本字段的指南。
任何帮助请。提前致谢。

i want to add facility in my iOS application that user can reply to the my message directly from the push notification. Like iMessage app is doing it in iOS 8. I am able to add buttons to push notification but did not found any guide on how to add text field. Any Help Please. Thanks in advance.

---------------------------- -------------------------------------------------- ------------

我知道如何添加动作(按钮),但如何添加文本字段或文本视图输入

I know how to add action(buttons) but how to add a text field or text view for input

推荐答案

在询问时,使用提供的API无法做到这一点。 UIUserNotificationAction 对象仅代表您可以添加的其他按钮,但您无法直接输入文本。现在,您应该添加一个回复按钮,然后点击,打开应用程序,键盘可见,以便用户可以回复。

At the time of asking, this was not possible using the provided API. UIUserNotificationAction objects only represented additional buttons you can add, but you cannot input text directly. For now, you should add a "Reply" button, and on tap, opens the app with the keyboard visible so users can reply.

使用iOS 9 SDK,这是可以通过将 UIUserNotificationActionBehaviorTextInput 设置为通知操作的行为来实现。
请务必阅读文档以获取更多信息。

With iOS 9 SDK, this is possible by setting UIUserNotificationActionBehaviorTextInput as the behavior of the notification action. Make sure to read the documentation for more information.

请参阅这个回答了一个如何在Swift中实现这个目的的例子。

See this answer for an example how to achieve this in Swift.

这篇关于在远程通知中添加文本字段,iOS 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆