iphone - Files Deleting from Table View but not from Document Directory by using Swipe Gesture -
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]; }
any suggestion?
following code how delete file document directory :
nsstring *imagename = @"name of file" nsfilemanager *filemanager = [nsfilemanager defaultmanager]; nsarray *paths = nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes); nsstring *documentsdirectory = [paths objectatindex:0]; [filemanager removeitematpath:[documentsdirectory stringbyappendingpathcomponent:imagename] error:nil];
Comments
Post a Comment