【发布时间】:2012-10-22 20:22:15
【问题描述】:
我想从我的 HomeDirectory 中删除多个项目。
我正在使用 UICollectionView 和 allowsMultipleSeletion = YES;
之后,我将 NSIndexPath 的选定项目保存在 NSMutableArray 中。
我正在尝试使用此代码
NSString *path = [NSHomeDirectory() stringByAppendingString:@"/Documents/Photos/"]
NSFileManager *manager = [NSFileManager defaulManager]
NSString *result = [path stringByAppendingFormat:@"%@"[manager contentsOfDirectoryAtPath:path error:nil] objectAtIndex:0];
[manager removeItemsAtPath:result];
问题是我如何在objectAtIndex上的数组中传递NSIndexPath?
【问题讨论】:
-
而不是
stringByAppendingFormat:@"%@", anotherString使用stringByAppendingString:anotherString- 不要浪费处理器时间。更好的是,使用stringByAppendingPathComponent:- 不要重新发明轮子。
标签: iphone ios uicollectionview