Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone iOS-使用AVCaptureSession拍摄图像_Iphone_Ios_Objective C_Xcode - Fatal编程技术网

Iphone iOS-使用AVCaptureSession拍摄图像

Iphone iOS-使用AVCaptureSession拍摄图像,iphone,ios,objective-c,xcode,Iphone,Ios,Objective C,Xcode,我想用iOS版的AVCaptureSession拍照,我可以拍照,但它像打印屏幕一样拍摄并保存在PhotoLibrary上,我如何才能获得真实的图片而不是打印屏幕,并将其保存在视图中而不是库中,请您在这一实现中帮助我 提前谢谢 这是我的密码: CGImageRef UIGetScreenImage(void); - (void) scanButtonPressed { CGImageRef screen = UIGetScreenImage();(what should I use here

我想用iOS版的AVCaptureSession拍照,我可以拍照,但它像打印屏幕一样拍摄并保存在PhotoLibrary上,我如何才能获得真实的图片而不是打印屏幕,并将其保存在视图中而不是库中,请您在这一实现中帮助我

提前谢谢

这是我的密码:

CGImageRef UIGetScreenImage(void);
- (void) scanButtonPressed {

CGImageRef screen = UIGetScreenImage();(what should I use here instead of 
UIGetScreenImage)
UIImage* image = [UIImage imageWithCGImage:screen];
CGImageRelease(screen);


// Save the captured image to photo album
UIImageWriteToSavedPhotosAlbum(image, self,   
@selector(image:didFinishSavingWithError:contextInfo:), nil);

}

- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void
*)contextInfo
{
UIAlertView *alert;

if (error)
    alert = [[UIAlertView alloc] initWithTitle:@"Error"
                                       message:@"Unable to save image to Photo Album."
                                      delegate:self cancelButtonTitle:@"Ok"
                             otherButtonTitles:nil];
else {
CoverCapturePhoto *c = [[CoverCapturePhoto alloc] init];
[self.navigationController pushViewController:c animated:YES];
    [c.captureImage setImage:image];
}

[alert show];
}

您需要调查并使用
AVCaptureStillImageOutput
。苹果提供了演示如何使用相机拍摄图像的软件

您正在使用
UIImageWriteToSavedPhotosAlbum
显式保存图像-不需要这样做。只需在图像视图或类似视图中使用
图像



或者,如果我误解了,请参阅。

您需要调查并使用
avcapturesillimageoutput
。苹果提供了演示如何使用相机拍摄图像的软件

您正在使用
UIImageWriteToSavedPhotosAlbum
显式保存图像-不需要这样做。只需在图像视图或类似视图中使用
图像



或者,如果我误解了,请参见。

你的意思是使用相机,还是拍摄屏幕抓图但不使用私人API???@Wain使用相机拍照并将其显示给其他屏幕你的意思是使用相机,或者拍摄屏幕抓图但不使用私人API???@Wain使用相机拍摄照片并将其显示给其他屏幕否我不需要截图,但如何在imageView上保存我的图像?不,我不需要截图,但如何在imageView上保存我的图像?