用于电子邮件附件的多选表格视图控制器项目

时间:2012-07-02 16:31:39

标签: objective-c xcode

这是我的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];

    }
}

}

0 个答案:

没有答案