iOS以编程方式拍摄屏幕截图
在iOS7中拍摄屏幕最有效的方法是什么。我尝试了一些方法,但在iPad上拍摄截图大约需要1-1.5秒,我需要立即拍摄。有什么方法可以在瞬间完成屏幕截图吗?这会有帮助吗-iOS以编程方式拍摄屏幕截图,ios,screenshot,Ios,Screenshot,在iOS7中拍摄屏幕最有效的方法是什么。我尝试了一些方法,但在iPad上拍摄截图大约需要1-1.5秒,我需要立即拍摄。有什么方法可以在瞬间完成屏幕截图吗?这会有帮助吗- if ([[UIScreen mainScreen] bounds].size.height == 568) { size = CGSizeMake(320,500); } else{ size = CGSizeMake(320,416); } C
if ([[UIScreen mainScreen] bounds].size.height == 568)
{
size = CGSizeMake(320,500);
}
else{
size = CGSizeMake(320,416);
}
CGRect screenrect = [[UIScreen mainScreen]bounds];
UIGraphicsBeginImageContext(size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor]set];
CGContextFillRect(ctx, screenrect);
[self.view.layer renderInContext:ctx];
UIImage *image1=UIGraphicsGetImageFromCurrentImageContext();
发件人:
从iOS7开始,UIView类提供了一个方法
-drawViewHierarchyInRect:后屏幕更新
然后使用-drawViewHierarchyInRect:AfterScreenUpdate或-SnapshotViewAfterScreenUpdate:methods.查看一下,它可能会对您有所帮助!Well RenderContext是一种缓慢的方法: