2

我想从我的 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];

问题是我如何传递NSIndexPathArray on objectAtIndex

4

2 回答 2

1

您好,这是您的代码

NSString *path = [NSHomeDirectory() stringByAppendingString:@"/Documents/Photos/"]

NSFileManager *manager = [NSFileManager defaulManager]

for(NSIndexPath *indexPath in array)
{

       NSString *result = [path stringByAppendingFormat:@"%@"[manager  contentsOfDirectoryAtPath:path error:nil] objectAtIndex:indexPath.row];        

    [manager removeItensAtPath:result];

}
于 2012-10-22T20:50:31.497 回答
0

使用该item属性从NSIndexPath.

于 2012-10-22T20:40:31.360 回答