1

这是我的 XCode 4.3.2 问题...我有一个表格,在表格控制器中显示多选 NSArray 数据。我想在表格中选择多个项目,单击视图控制器底部的按钮,然后将表格的 NSArray 中引用的项目中选定的文档附加到电子邮件中。我的电子邮件部分工作正常,但没有附加任何内容。我的多选复选标记也可以正常工作。关于完成多选附件的任何想法?我假设我必须构建一个 mutableArray,其中表格数据单元格文本 = 本地 PDF 文件名。???

这是我认为必须编辑才能构建数组的一些代码?

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
if ([selectedCell accessoryType] == UITableViewCellAccessoryNone) {
    [selectedCell setAccessoryType:UITableViewCellAccessoryCheckmark];
    [selectedIndexes addObject:[NSNumber numberWithInt:indexPath.row]];
    NSLog(@"Items I selected @ %d:", indexPath.row);
    NSLog(@"Items I selected: %@", selectedIndexes);
} else {
    [selectedCell setAccessoryType:UITableViewCellAccessoryNone];
    [selectedIndexes removeObject:[NSNumber numberWithInt:indexPath.row]];
    NSLog(@"Items I de-selected @ %d:", indexPath.row);
}
[tableView deselectRowAtIndexPath:indexPath animated:NO];

}

邮件组件:

- (IBAction)sendMailButton:(id)sender {
{
    if ([MFMailComposeViewController canSendMail])
    {
        MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc]      init];

        mailer.mailComposeDelegate = self;

        [mailer setSubject:@"Documentation Attached"];
        [mailer setMessageBody:@"Attached are documents from staff." isHTML:NO];

                   //[mailer setMessageBody:emailBody isHTML:NO];

        //iPad presentation enhancement:
        mailer.modalPresentationStyle = UIModalPresentationPageSheet;

        [self presentModalViewController:mailer animated:YES];


    }
    else
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                                        message:@"Your device doesn't support the composer sheet"
                                                       delegate:nil
                                              cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
        [alert show];

    }
}

}

4

0 回答 0