远程捕获iphone设备的屏幕。
可能重复:远程捕获iphone设备的屏幕。,iphone,ios,Iphone,Ios,可能重复: 我正在构建一个应用程序,在其中我必须远程捕获iPhone手机(根手机)的屏幕。。。 意味着我必须远程捕获从一台iPhone到另一台iPhone的屏幕 请建议我 提前谢谢 要以编程方式捕获屏幕快照,您可以: #import <QuartzCore/QuartzCore.h> - (void)saveScreenSnapshot:(UIView *)view { UIGraphicsBeginImageContext(view.frame.size); [
我正在构建一个应用程序,在其中我必须远程捕获iPhone手机(根手机)的屏幕。。。 意味着我必须远程捕获从一台iPhone到另一台iPhone的屏幕 请建议我
提前谢谢 要以编程方式捕获屏幕快照,您可以:
#import <QuartzCore/QuartzCore.h>
- (void)saveScreenSnapshot:(UIView *)view
{
UIGraphicsBeginImageContext(view.frame.size);
[view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// do what you want with this image; I frequently just drop it in the device's photo album
//
// UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
显然,您必须将
QuartzCore.framework
添加到目标应用程序的库中 这是否可能捕获ios设备的屏幕?当应用程序进入后台时,无论窗口是打开的,我都可以进行屏幕捕获吗?
NSData *data = UIImagePNGRepresentation(image);