大佬教程收集整理的这篇文章主要介绍了ios – 如何将图像从相机保存到iPhone库中的特定文件夹?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的代码:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { NSString *mediaType = [info valueForKey:UIImagePickerControllerMediaType]; if([mediaType isEqualToString:(NSString*)kUTTypeImage]) { UIImage *pho@R_435_10586@ken = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; self.imageView.image = pho@R_435_10586@ken; //Save Photo to library only if it wasnt already saved i.e. its just been taken if (picker.sourCEType == UIImagePickerControllersourceTypeCamera) { UIImageWriteToSavedPhotosAlbum(pho@R_435_10586@ken,self,@SELEctor(image:didFinishSavingWithError:contexTinfo:),nil); } } [picker dismissviewControllerAnimated:YES completion:NULL]; } - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contexTinfo:(void *)contexTinfo { UIAlertView *alert; if (error) { alert = [[UIAlertView alloc] initWithtitle:@"Error!" message:[error localizedDescription] delegate:nil cancelButtontitle:@"OK" otherButtontitles:nil]; [alert show]; } }
我试过这样做下面的代码,但我不知道它在哪里将图像保存到我的iPhone设备中的App资源:
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES) objectATindex:0]; NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] StringByAppendingPathComponent:@"EMS_FOLDER"]; NSString *folderPath = [documentsDirectory StringByAppendingPathComponent:@"Files"];
- (IBACtion)takePhoto { UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init]; imagePickerController.sourCEType = UIImagePickerControllersourceTypeCamera; imagePickerController.ediTing = YES; imagePickerController.delegate = (id)self; [self presentModalViewController:imagePickerController animated:YES]; } - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image ediTingInfo:(NSDictionary *)ediTingInfo { [self.library saveImage:image toAlbum:@"Touch Code Magazine" withCompletionBlock:^(NSError *error) { if (error!=nil) { NSLog(@"Big error: %@",[error description]); } }]; [picker dismissModalViewControllerAnimated:NO]; }
http://www.touch-code-magazine.com/ios5-saving-photos-in-custom-photo-album-category-for-download/
以上是大佬教程为你收集整理的ios – 如何将图像从相机保存到iPhone库中的特定文件夹?全部内容,希望文章能够帮你解决ios – 如何将图像从相机保存到iPhone库中的特定文件夹?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。