views:

60

answers:

1

I got a strange problem with MFMailComposeViewController.

The first time it is displayed using presentModalViewController:animated, everything works perfectly.

The second time it is blank, with nothing on screen except for the navigation bar, the Cancel & Send button.

I have already set the mailComposeDelegate correctly, and dismiss the view controller properly in the delegate.

Any idea why that happens?

EDIT: The code is:

- (void)viewDidLoad {
  mailComposeViewController = [[MFMailComposeViewController alloc] init];   
  [mailComposeViewController setMailComposeDelegate:self];
}

- (void)dealloc {
  [mailComposeViewController release];
}

- (void)mail {
  [self presentModalViewController:mailComposeViewController animated:YES];
}
A: 

Okay, I somehow solved my problem. I moved my MFMailComposeViewController's init & release code from viewDidLoad & dealloc, respectively to exactly where I choose to present the view controller.

Then, it worked.

QAD