截取应用程序中的屏幕截图
问题描述:
嘿iPhone的开发者在那里, 有没有一种方法来点击一个圆形的矩形按钮,并截图,我不希望我的用户按睡眠+主页按钮拍照!如果你知道,请告诉我需要的代码和框架。 -Thanks截取应用程序中的屏幕截图
答
这里是一个类的方法,将返回的UIView和的CGRect的一个UIImage你给它:
+ (UIImage *)captureView:(UIView *)view withArea:(CGRect)screenRect {
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);
[view.layer renderInContext:ctx];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
+0
我可以添加newImage到UIImage * pic = [UIImage imageNamed:@“newImage”]; 在其他功能? newImage是什么格式? – wagashi 2011-09-20 18:05:03
http://*.com/questions/2200736/how-to-的重复以编程方式拍摄 – 2011-02-13 20:55:08