我使用来自 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];
});
}
}
}