我有这个数组:
NSArray *currentPath;
它在这里被填充:
currentPath = [[[self.tableData objectAtIndex:indexPath.row] objectForKey:@"Name"] componentsSeparatedByString:@"FTP\\"];
我需要重新填充这个数组
NSString *newPreviousPath = [previousPath stringByReplacingOccurrencesOfString:nextItemToRemoveString withString:@""];
currentPath = [newPreviousPath];
但我一直收到这个错误:
Expected identifier
我该如何解决这个问题并完成这个任务?
最佳答案
与 swift 不同,在 objective c 中你应该这样做:
currentPath = @[newPreviousPath];
看看魔术 @
符号在 Objective C 中的作用,详细答案在这里:Is there some literal dictionary or array syntax in Objective-C?
关于objective-c - 从数组中删除所有项目并重新填充它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32385242/