简体   繁体   English

MFMailComposeViewController:视图显示时如何获得通知?

[英]MFMailComposeViewController: how to get notified when view appears?

In my app, users can take a picture with the camera or pick one from the library and email it as an attachment. 在我的应用程序中,用户可以使用相机拍摄照片或从图库中选择一张并通过电子邮件将其作为附件发送。 I use the MFMailComposeViewController for seamless email. 我将MFMailComposeViewController用于无缝电子邮件。 On my iPhone 3GS, it takes about 5-7 seconds for the email view to appear with the attachment. 在我的iPhone 3GS上,与附件一起显示的电子邮件视图大约需要5-7秒。

Now I want to show a progress indicator view when the user pushes the "Send" button and hide that view when the email view comes up. 现在,我想在用户按下“发送”按钮时显示进度指示器视图,并在出现电子邮件视图时隐藏该视图。 The problem is that the MFMailComposeViewController delegate only calls when the email sending is done . 问题是MFMailComposeViewController委托仅在电子邮件发送完成后才调用

Can I get notified somehow when the email window appears on the screen? 当电子邮件窗口出现在屏幕上时,我能以某种方式得到通知吗?

Edit: I just thought about it... Can't you just add the progress indicator in your view and the composer view will just get on top of it? 编辑:我只是考虑过...您不能只在视图中添加进度指示器,而作曲者视图将位于它之上吗? This way you could easily remove the indicator when the MFMailComposerViewController delegate calls its methods. 这样,当MFMailComposerViewController委托调用其方法时,您可以轻松删除该指示器。

I don't see any simple way to get notified. 我没有收到通知的任何简单方法。 What about writing a category for this? 为此写一个类别呢?

@interface MFMailComposeViewController (MyAddition)

@end


@implementation MFMailComposeViewController (MyAddition)

- (void)viewDidAppear:(BOOL)animated {
    [self.mailComposeDelegate mailComposerDidAppear];
    [super viewDidAppear:animated];
}

@end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UIView - 如何在加载视图时收到通知? - UIView - How to get notified when the view is loaded? NSViewController在添加或删除视图时会收到通知吗? - Does NSViewController get notified when its view is added or removed? iphone UIView - 在加载视图时收到通知? - iphone UIView - Get notified when view has loaded? 使用MFMailComposeViewController发送邮件,关闭模式视图控制器时获取“ EXC_BAD_ACCESS” - Using MFMailComposeViewController to send a mail, get “EXC_BAD_ACCESS” when dismissing the modal view controller 当UITextField成为FirstResponder时得到通知 - get notified when UITextField becomeFirstResponder iOS - 如何在AFHTTPClient完成所有操作时收到通知 - iOS - How to get notified when AFHTTPClient is done with all operations 如何在状态栏高度更改时收到通知? - How to get notified when the status bar height changes? 如何在iOS中卸载我们的应用程序时收到通知 - How to get notified when our app is uninstalled in iOS 当AVAudioPlayer循环回到开头时,如何获得通知? - How to get notified when AVAudioPlayer loops back to the beginning? 键盘出现时如何滚动查看? - How to scroll view up when keyboard appears?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM