我想使用自定义相机,出于某些安全目的,我不想在我的图库中保存捕获图像。
先谢谢。
答案 0 :(得分:0)
UIImage *imgTaken;
NSString *docsDir,*imgNewPath;
NSData *imgData;
NSFileManager *filemgr;
dirPaths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES);
docsDir = [dirPaths objectAtIndex:0];
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
imgTaken = info[UIImagePickerControllerOriginalImage];
imgNewPath = [docsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"name your image"]];
imgData = UIImagePNGRepresentation(imgTaken);
[imgData writeToFile:imgNewPath atomically:YES];
[picker dismissViewControllerAnimated:YES completion:nil];
}
我希望它会对你有所帮助。