tags:

views:

106

answers:

1

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. On my iPhone 3GS, it takes about 5-7 seconds for the email view to appear with the attachment.

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.

Can I get notified somehow when the email window appears on the screen?

A: 

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.

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
bddckr
I'm using a modal alert box which shows on top of the email view.
Karsten Silz
Okay, then try to use the category. Make sure to implement `-mailComposerDidAppear`. (If you want to get rid of the compiler warning then make another category of the `MFMailComposeViewControllerDelegate`.
bddckr
Adding the notification through a category is the solution.
Karsten Silz
Make sure to accept an answer!
bddckr