2
我需要將數據從2個數組保存到文檔目錄,第一個保存,但第二個不是!將NSArray數據保存到NSDocumentDirectory中的2個文件中
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
NSString *documentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
NSString *rangePath = [documentsDir stringByAppendingPathComponent:@"Range.plist"];
NSString *indexPath = [documentsDir stringByAppendingPathComponent:@"Select.plist"];
[finalMutable writeToFile:rangePath atomically:YES];
[finalIndex writeToFile:indexPath atomically:YES];
}
更新:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[finalIndex addObject:[NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section]];
}
PLS添加什麼finalMutable和finalIndex包含,finalIndex一定是問題 –
它們都有相同的,這是NSLog:finalMutable count:5,finalIndex count:5 –