空白MFMailComposeViewController第二次出现?

时间:2021-05-20 11:47:28

I got a strange problem with MFMailComposeViewController.

我遇到了一个奇怪的问题,MFMailComposeViewController。

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

第一次使用presentModalViewController显示它:动画,一切都很完美。

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.

我已经正确地设置了mailComposeDelegate,并在委托中适当地忽略了视图控制器。

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

1 个解决方案

#1


0  

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.

好吧,我总算解决了我的问题。我将我的MFMailComposeViewController的init & release代码从viewDidLoad & dealloc移动到我选择显示视图控制器的地方。

Then, it worked.

然后,它工作。

#1


0  

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.

好吧,我总算解决了我的问题。我将我的MFMailComposeViewController的init & release代码从viewDidLoad & dealloc移动到我选择显示视图控制器的地方。

Then, it worked.

然后,它工作。