ios - 访问 MFMessageComposeViewController 的第一响应者

标签 ios cocoa-touch

我有兴趣做类似的事情to this , 但是 MFMessageComposeViewController 的组件 subview 与 MFMailComposeViewController 大不相同.

我想出了如何将焦点设置在输入上,让您只需调用 setRecipients: 即可键入消息文本。带有一个包含空白 NSString 的数组。但是,我想将粘贴板上的非文本粘贴到输入中,所以我不能简单地使用 setBody: .

问题:
我需要做的是获取对作为我的 MFMessageComposeViewController 的当前第一响应者的实际文本字段的引用。这样,我就有了一个“发件人”,可以传递给 UIPasteboard 的 paste:方法。问题是,我似乎无法像 MFMailComposeViewController 那样走 subview 层次结构,所以我无法找出哪个 View 是第一响应者。

我什至 tried this ,但如果我执行 [myMessageVC.view findFirstResponder], View 总是返回为零

最佳答案

请注意,您不应该将手放在该 View 中。 Apple 将拒绝您的应用程序这样做。您只能设置正文和收件人。

Important The message composition interface itself is not customizable and must not be modified by your application. In addition, after presenting the interface, your application is unable to make further changes to the SMS content. The user can edit the content using the interface, but programmatic changes are ignored. Thus, you must set the values of content fields, if desired, before presenting the interface



http://developer.apple.com/library/ios/#documentation/MessageUI/Reference/MFMessageComposeViewController_class/Reference/Reference.html

关于ios - 访问 MFMessageComposeViewController 的第一响应者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10155866/

相关文章:

objective-c - 如何追踪 SIGABRT 的原因

ios - 无法将 UITextField 的内容从一个 Controller 传递到另一个 Controller

ios - ld:架构 armv7 Xcode 项目的 xx 重复符号

ios - 如何快速访问云驱动器以将文件导入我的应用程序?

android - React Native - 无法在 <Text> 之间调用函数

cocoa-touch - 在扩展中添加便利的初始值设定项并在子类上调用它们

ios - 可达性和国际漫游

swift - 使用 View Swift 部分覆盖 UIStatusBar

ios - phonegap xcode 4.3

objective-c - 用于打开具有特定日期的 native 日历的 URL 方案