私は2つのクラスを持っています: MainVC DownloadedFilesView
MainVC クラスには、iPhone ディレクトリのすべてのファイルのリストを格納する NSMutableArray があります。この配列は、テーブルビュー (DownloadedFilesView に存在) のデータソースです。(MainVC テーブルビューから) 特定の行を選択すると、このデータを MainVC から DownloadedFilesView に次のように送信します。
if (indexPath.section == 1) {
DownloadedFilesView *downloadView = [[DownloadedFilesView alloc] initWithNibName:@"DownloadedFilesView" bundle:nil];
int count;
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [paths objectAtIndex:0];
NSArray *directoryContent = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL];
for (count = 0; count < (int)[directoryContent count]; count++)
{
NSString *fileNames = [directoryContent objectAtIndex:count];
[downloadView.arrayOfDirFiles addObject:fileNames];
}
[self.navigationController pushViewController:downloadView animated:YES];
}
このデータソースを別の配列「arrayOfDirFiles」(DownloadedFilesViewにあります)に保存しています。今、私はこの配列を初期化しています
initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
お気に入り:
arrayOfDirFiles = [[NSMutableArray alloc] init];
これで、この配列は DownloadedFilesView のテーブルビューのデータソースになります
tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (theTableView.editing) {
//arrayOfFileNamesToSave is the array which I want filtered when selecting particular cell
[arrayOfFileNamesToSave addObject:[arrayOfDirFiles objectAtIndex:indexPath.row]];
}
//NSLog(@"aaa....%@",arrayOfFileNamesToSave);
}
現在、これはエラーをスローしています。これを機能させる最良の方法は何ですか? 助けてください!前もって感謝します!