これが私のXCode 4.3.2の問題です...テーブルコントローラーに複数選択のNSArrayデータを表示するテーブルがあります。テーブルで複数のアイテムを選択し、View Controller の下部にあるボタンをクリックして、テーブルの NSArray で参照されているプロジェクトで選択したドキュメントを電子メール メッセージに添付したいと考えています。メール部分は問題なく動作していますが、何も添付していません。また、複数選択のチェック マークが正しく機能しています。複数選択のアタッチメントを実現するためのアイデアはありますか? テーブルデータセルテキスト=ローカルPDFファイル名であるmutableArrayを構築する必要があると思います.???
配列を構築するために編集する必要があると思われるコードの一部を次に示します。
- (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];
}
}
}