ios - save picture in folder which is located in document direcotory in iphone -
i want create folder in document directory , want save images in folder. have tried folder , images storing in document directory..but want store images inside folder.my code working fine images not saving inside folder..
nserror *error; nsstring *adocumentsdirectory = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; nsstring *datapath = [adocumentsdirectory stringbyappendingpathcomponent:@"folder"]; [[nsfilemanager defaultmanager] createdirectoryatpath:datapath withintermediatedirectories:no attributes:nil error:&error]; nsinteger anindex = 0; (uiimage *animage in _chosenimages) { nsstring *animagename = [nsstring stringwithformat:@"%d.png", anindex++]; nsstring *animagepath = [nsstring stringwithformat:@"%@/%@", adocumentsdirectory, animagename]; nslog(@"the path is=%@",animagepath); nsdata *animagedata = uiimagepngrepresentation(animage); [animagedata writetofile:animagepath atomically:yes]; }
i guess "animagepath" still pointing documents directory. edit "datapath" argument below
nsstring *animagepath = [nsstring stringwithformat:@"%@/%@", datapath, animagename];
Comments
Post a Comment