【发布时间】:2015-03-09 18:11:16
【问题描述】:
if (editingStyle == UITableViewCellEditingStyleDelete){
NSFileManager *fileManager = [[NSFileManager alloc]init];
NSString *filePath = [documentsDirectory
stringByAppendingPathComponent:[NSString stringWithFormat:@"%@ ",[self->localSongs objectAtIndex:indexPath.row]]];
[fileManager removeItemAtPath:filePath error:nil];
[self->localSongs removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
[self.tableView reloadData];
}
有什么建议吗?
【问题讨论】:
-
你的文件路径即将到来吗? nslog 找出来
-
看来您的 filePath 不正确。 NSError *error = nil;并将 ist 作为错误传递:&error;并使用 NSLog(@"error: %@",error); 检查输出
-
是的。 ifpath 错误如何在表格视图中列出歌曲....
-
我用来列出歌曲的相同路径.....localSongs=[[NSMutableArray alloc]init]; NSArray * 路径 = NSSearchPathForDirectoriesInDomains ( NSDocumentDirectory, NSUserDomainMask, YES);文档目录 = [路径 objectAtIndex:0]; NSDirectoryEnumerator *de = [[NSFileManager defaultManager] enumeratorAtPath:documentsDirectory] ;
标签: iphone ios document swipe gesture