0

我试图在我的应用程序中调出一个电子邮件窗口,但是导航控制器遮住了顶部工具栏,该工具栏应该有取消和发送。

我相信原因是我在打电话

 if ([MFMailComposeViewController canSendMail]) {
            MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
            controller.mailComposeDelegate = self;
            [controller setToRecipients:[NSArray arrayWithObject:@"internalapps@microstrategy.com"]];
            [controller setSubject:@"Mobile HelpDesk App"];
            [controller setMessageBody:@"" isHTML:NO];
            if (controller){
                [self presentViewController:controller animated:YES completion:^{}];
            }

        }

从控制滚动视图(用于分页)内的视图的子视图控制器。

如何让工具栏位于导航栏的顶部?现在,它只显示新的电子邮件窗口,但我无法取消或发送电子邮件。

我尝试使用[self.parentViewController presentViewController:controller animated:YES completion:^{}];,但这并没有做任何事情。

谢谢!

4

2 回答 2

1

You can't use presentViewController:... from a view controller whose view isn't at the top of the view hierarchy (and so most likely doesn't occupy the whole screen). As you've seen, this results in a presented view which is perhaps partially visible and perhaps doesn't respond to touches in some areas.

Trying self.parentViewController is the correct solution (though the code you show is invalid). You need to ensure that you navigate far enough up the hierarchy to get to the 'root' view controller and present from there.

于 2013-05-10T21:04:04.973 回答
0

This sounds like it could be as simple as changing:

 [self presentViewController:controller animated:YES completion:^{}];

to

 [self.navigationController presentViewController:controller animated:YES completion:^{}];

Hope this helps you.

于 2013-05-10T21:04:45.540 回答