ios - Create custom image gallery in iphone -
i have used below code pick photo gallery or straight using camera
- (void)actionsheet:(uiactionsheet *)actionsheet clickedbuttonatindex:(nsinteger)buttonindex { uiimagepickercontroller *imagepickercontroller = [[uiimagepickercontroller alloc]init]; imagepickercontroller.delegate = self; if (buttonindex == 0) { photobuttonnum=0; [self presentviewcontroller:imagepickercontroller animated:yes completion:nil]; imagepickercontroller.sourcetype = uiimagepickercontrollersourcetypephotolibrary; } else if (buttonindex == 1) { photobuttonnum=1; [self presentviewcontroller:imagepickercontroller animated:yes completion:nil]; imagepickercontroller.sourcetype = uiimagepickercontrollersourcetypecamera; } }
i looking create custom directory(folder) of own application save picked photos in iphone. need help to
create custom directory of own app want save picked photo in custom directory.i new guy in iphone
development, waiting valuable help. in advance.
this site helpful create , save photo in directory
and can utilize next code.
- (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { uiimage *pickedimage = [info objectforkey:uiimagepickercontrolleroriginalimage]; nsdata *imagedata = uiimagepngrepresentation(pickedimage); nsstring *documentsdirectory = [nssearchpathfordirectoriesindomains(nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; nsstring *path = [documentsdirectory stringbyappendingpathcomponent:@"imagename.png"]; nserror * error = nil; [imagedata writetofile:storepath options:nsdatawritingatomic error:&error]; if (error != nil) { nslog(@"error: %@", error); return; } }
ios iphone objective-c uiimagepickercontroller
No comments:
Post a Comment