模态视图无法正确显示

发布于 2024-12-06 08:02:38 字数 765 浏览 1 评论 0原文

我正在编写一个 iPad 应用程序,并希望在主屏幕(根视图控制器)上放置一个选项,以允许用户通过电子邮件发送反馈。我希望邮件以“UIModalPresentationFormSheet”样式显示。但是,当我运行代码时,它显示为全屏。我做错了什么?这是我正在使用的代码:

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;
    NSArray *toAddresses = [[NSArray alloc] initWithObjects:@"[email protected]", nil];
    [picker setToRecipients:toAddresses];
    [toAddresses release];              
    [picker setSubject:@"App Feedback"];
    self.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentModalViewController:picker animated:YES];
    [picker release];

I am writing an iPad app and want to put an option on the home screen (root view controller) to allow users to e-mail feedback. I would like the mail to appear with the style "UIModalPresentationFormSheet". However, when I run the code, it appears full screen. What am I doing wrong? Here is the code I am using:

    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;
    NSArray *toAddresses = [[NSArray alloc] initWithObjects:@"[email protected]", nil];
    [picker setToRecipients:toAddresses];
    [toAddresses release];              
    [picker setSubject:@"App Feedback"];
    self.modalPresentationStyle = UIModalPresentationFormSheet;
    [self presentModalViewController:picker animated:YES];
    [picker release];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

少年亿悲伤 2024-12-13 08:02:38

您必须设置所呈现的 viewController 的样式,而不是呈现它的样式。因此,设置 MFMailComposeViewController 的属性,您应该就可以了。

You must set the style of the viewController being presented, not on the one presenting it.. So set the property of the MFMailComposeViewController and you should be ok.

稳稳的幸福 2024-12-13 08:02:38

您需要在新视图控制器上设置 modalPresentationStyle,而不是 self。

You need to set modalPresentationStyle on your new view controller, not self.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文