如何向 MFMessageComposeViewController 添加监听器?
我正在尝试使用 MFMessageComposeVieController 在 iPhone 上发送短信,并且我想添加一个侦听器来识别何时发送短信(换句话说,当用户按下“发送”时)。这个的语法是什么?
例如,我知道对于文本字段,侦听器的示例如下: [textField addTarget:self 操作:@selector(methodName) forControlEvents:UIControlEventEditingDidEndOnExit];
I am trying to send an SMS on an iPhone using MFMessageComposeVieController and I want to add a listener that recognizes when the SMS is sent (in other words, when the user presses "Send"). What is the syntax for this?
For example, I know that with a textField, an example of a listener would be:
[textField addTarget:self action:@selector(methodName) forControlEvents:UIControlEventEditingDidEndOnExit];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Google 非常有帮助...
第三个结果是短信教程。
相关代码:
实现
MessageComposeResultSent
案例以了解消息何时发送。Google is very helpful...
Third result is an SMS tutorial.
Relevant code:
Implement the
MessageComposeResultSent
case to know when the message has been sent.您想要向
MFMessageComposeViewController
添加委托。在委托的messageComposeViewController:didFinishWithResult:
方法中,您可以检查 result 参数以了解用户是否取消或发送了短信。You want to add a delegate to your
MFMessageComposeViewController
. In the delegate'smessageComposeViewController:didFinishWithResult:
method, you can check the result parameter to see whether the user canceled or sent the SMS.