Iphone iOS-使用AVCaptureSession拍摄图像
我想用iOS版的AVCaptureSession拍照,我可以拍照,但它像打印屏幕一样拍摄并保存在PhotoLibrary上,我如何才能获得真实的图片而不是打印屏幕,并将其保存在视图中而不是库中,请您在这一实现中帮助我 提前谢谢 这是我的密码: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
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上保存我的图像?