gpt4 book ai didi

ios - MailComposer 在侧边栏中打开

转载 作者:行者123 更新时间:2023-11-29 03:55:59 25 4
gpt4 key购买 nike

我使用来自 Github 的 JTRevealSidebar。当我单击左侧边栏中的单元格(反馈)时遇到问题,我想打开 MailComposer。 MailComposer 已打开,但仅在左侧边栏中打开。谁能帮帮我?

enter code here

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
/*if (self.sidebarDelegate) {
NSObject *object = [NSString stringWithFormat:@"ViewController%d", indexPath.row];
[self.sidebarDelegate sidebarViewController:self didSelectObject:object atIndexPath:indexPath];
}*/

if(indexPath.section == 0){
if(indexPath.row == 1){ // Feedback{
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;

[mailController setSubject:@"Feedback für testapp"];
// Fill out the email body tex
NSString *emailBody = [NSString stringWithFormat:@"\n\n\n\nApp: %@ \n App-Version: %@ \nModel: %@ \n Version: %@",
@"TestApp",
[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"],
[UIDevice currentDevice].model,
[UIDevice currentDevice].systemVersion];
[mailController setMessageBody:emailBody isHTML:NO];
[mailController setToRecipients:[NSArray arrayWithObjects:@"support@testapp.com",nil]];

dispatch_async(dispatch_get_main_queue(), ^{
// whatever code you want to run on the main thread
[self presentModalViewController:mailController animated:YES];
});

}
}

}

最佳答案

首先,您应该关闭您所在的 View Controller 。这是因为侧边栏本身就是一个 View Controller 。然后呈现 mailController,使其显示在中心 View Controller 中。

代码更改:

dispatch_async(dispatch_get_main_queue(), ^{
[self dismissModalViewController];
[self presentModalViewController:mailController animated:YES];
});

改用这个:

[self dismissViewControllerAnimated:YES completion:nil];

关于ios - MailComposer 在侧边栏中打开,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16497766/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com