jjzjj

nsdocumentdirectory

全部标签

ios - Swift - 从 UITableView 中删除单元格

我正在按照此代码从UITableView中删除数据varrecordedAudioFilesURLArray=[URL]()functableView(_tableView:UITableView,canEditRowAtindexPath:IndexPath)->Bool{returntrue}functableView(_tableView:UITableView,commiteditingStyle:UITableViewCellEditingStyle,forRowAtindexPath:IndexPath){ifeditingStyle==.delete{recordedAu

ios - 检索文件创建或修改日期

我正在使用这段代码来尝试检索文件的最后修改日期:NSError*error=nil;NSDictionary*attributes=[[NSFileManagerdefaultManager]attributesOfItemAtPath:myFilePatherror:&error];if(attributes!=nil){NSDate*date=(NSDate*)[attributesobjectForKey:NSFileModificationDate];NSLog(@"Datemodiifed:%@",[datedescription]);}else{NSLog(@"Notfou

ios - 检索文件创建或修改日期

我正在使用这段代码来尝试检索文件的最后修改日期:NSError*error=nil;NSDictionary*attributes=[[NSFileManagerdefaultManager]attributesOfItemAtPath:myFilePatherror:&error];if(attributes!=nil){NSDate*date=(NSDate*)[attributesobjectForKey:NSFileModificationDate];NSLog(@"Datemodiifed:%@",[datedescription]);}else{NSLog(@"Notfou

ios - 使用 GCDWebServer 将 UIImage 发送到 LocalwebServer

我的应用程序使用GCDWebServer我使用AssetsLibrary从我的iPhone相册中获取一张照片,并将它们存储在NSDocumentDirectory中。我只想访问这张照片的Url以在网页中显示它们。这是我的代码:[_webServeraddHandlerForMethod:@"POST"path:@"/"requestClass:[GCDWebServerURLEncodedFormRequestclass]processBlock:^GCDWebServerResponse*(GCDWebServerRequest*request){ALAsset*asset=[sel

ios - 使用 GCDWebServer 将 UIImage 发送到 LocalwebServer

我的应用程序使用GCDWebServer我使用AssetsLibrary从我的iPhone相册中获取一张照片,并将它们存储在NSDocumentDirectory中。我只想访问这张照片的Url以在网页中显示它们。这是我的代码:[_webServeraddHandlerForMethod:@"POST"path:@"/"requestClass:[GCDWebServerURLEncodedFormRequestclass]processBlock:^GCDWebServerResponse*(GCDWebServerRequest*request){ALAsset*asset=[sel

ios - 将文件保存在swift 3的文档目录中?

我使用以下代码将文件保存在swift3的文档目录中:fileManager=FileManager.default//letdocumentDirectory=fileManager?.urls(for:.documentDirectory,in:.userDomainMask).firstasStringvarpath=NSSearchPathForDirectoriesInDomains(.documentDirectory,.userDomainMask,true)[0]asStringpath=path+nameletimage=#imageLiteral(resourceNa

ios - 将文件保存在swift 3的文档目录中?

我使用以下代码将文件保存在swift3的文档目录中:fileManager=FileManager.default//letdocumentDirectory=fileManager?.urls(for:.documentDirectory,in:.userDomainMask).firstasStringvarpath=NSSearchPathForDirectoriesInDomains(.documentDirectory,.userDomainMask,true)[0]asStringpath=path+nameletimage=#imageLiteral(resourceNa

ios - 如何在 Swift 中找到 NSDocumentDirectory?

我正在尝试使用代码获取Documents文件夹的路径:vardocumentsPath=NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory:0,NSSearchPathDomainMask:0,true)但Xcode给出错误:无法转换表达式的类型'AnyObject[]!'输入“NSSearchPathDirectory”我正在尝试了解代码中的错误。 最佳答案 显然,编译器认为NSSearchPathDirectory:0是一个数组,当然它期望类型是NSSearchPa

ios - 如何在 Swift 中找到 NSDocumentDirectory?

我正在尝试使用代码获取Documents文件夹的路径:vardocumentsPath=NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory:0,NSSearchPathDomainMask:0,true)但Xcode给出错误:无法转换表达式的类型'AnyObject[]!'输入“NSSearchPathDirectory”我正在尝试了解代码中的错误。 最佳答案 显然,编译器认为NSSearchPathDirectory:0是一个数组,当然它期望类型是NSSearchPa

iphone - 在 NSDocumentDirectory 和 UIScrollView 中删除

我的代码有问题,能够在UIScrollView中使用带图像的缩略图进行预览。我的图像来自NSDocumentDirectory。虽然我可以从中删除,但是当我从右到左的位置开始时,我可以从中删除(根据VIEW和NSDocumentDirectory)。问题:现在,无论如何我都可以删除,但是我有几个问题。首先,虽然我可以删除,但View没有排列,我的rearrangeItems:方法也没有被调用。其次,然后在第一次加载时我可以随意删除,但就像我说的那样rearrangeItems:方法没有被调用,所以他们的名字未重命名。第三,在第一次加载时,无论如何我都可以删除,但是当我退出应用程序时,我