Ios 在iphone中使用相机预览拍摄特定视图的屏幕
现在我用这个来拍摄屏幕截图。它工作正常,但相机预览显示为黑色。我需要为IOS6和IOS7拍摄带有摄像头预览的屏幕快照。任何值得接受的建议Ios 在iphone中使用相机预览拍摄特定视图的屏幕,ios,Ios,现在我用这个来拍摄屏幕截图。它工作正常,但相机预览显示为黑色。我需要为IOS6和IOS7拍摄带有摄像头预览的屏幕快照。任何值得接受的建议 CGRect screenRect = [[UIScreen mainScreen] bounds]; UIGraphicsBeginImageContext(screenRect.size); CGContextRef ctx = UIGraphicsGetCurrentContext(); [[UIColor whiteColor]
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor whiteColor] set];
CGContextFillRect(ctx, screenRect);
[self.view.layer renderInContext:ctx];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;