开发者

Blank MFMailComposeViewController the second time it is presented?

开发者 https://www.devze.com 2022-12-21 00:32 出处:网络
I got a strange problem with MFMailComposeViewController. The first time it is displayed using presentModalViewController:animated, everything works perfectly.

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];
}


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号