iphone将图像捕获到文档
我正在使用这种涂层,它不在模拟器上工作,但在设备上工作,并将图像保存在照片中。有什么方法可以在模拟器上使用它吗?或者有什么方法可以将捕获的图像存储到文档或资源文件夹中iphone将图像捕获到文档,iphone,image,camera,Iphone,Image,Camera,我正在使用这种涂层,它不在模拟器上工作,但在设备上工作,并将图像保存在照片中。有什么方法可以在模拟器上使用它吗?或者有什么方法可以将捕获的图像存储到文档或资源文件夹中 提前感谢。首先,据我所知,模拟器不支持UIGetScreenImage() 第二,如果您打算发布此应用程序,请停止使用UIGetScreenImage(),因为苹果再次禁止它,如您在: 第三,如果您使用它从相机捕获数据,则必须使用新的AVFoundation(是的,我知道iOS3上没有必要的方法) 第四,如果需要获取屏幕上UIKi
提前感谢。首先,据我所知,模拟器不支持UIGetScreenImage() 第二,如果您打算发布此应用程序,请停止使用UIGetScreenImage(),因为苹果再次禁止它,如您在: 第三,如果您使用它从相机捕获数据,则必须使用新的AVFoundation(是的,我知道iOS3上没有必要的方法) 第四,如果需要获取屏幕上UIKit元素的信息:
CGImageRef screen = UIGetScreenImage();
UIImage* image = [UIImage imageWithCGImage:screen];
CGImageRelease(screen);
// You could, e.g., 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;
// Unable to save the image
if (error)
alert = [[UIAlertView alloc] initWithTitle:@"Error"
message:@"Unable to save image to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
else // All is well
alert = [[UIAlertView alloc] initWithTitle:@"Success"
message:@"Image saved to Photo Album."
delegate:self cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alert show];
[alert release];
}