如何从后台应用程序获取运行iPhone的屏幕截图? [英] How to take screenshots of running iPhone from background app?

查看:647
本文介绍了如何从后台应用程序获取运行iPhone的屏幕截图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要制作一个可以持续运行的应用程序,并每秒从背景或屏幕录像中获取屏幕截图.由于iOS应用程序在沙箱中运行,因此可以实现.

I need to make an app which can keep running and taking screenshots from background every second or video recording of the screen. As iOS apps runs in the sandbox is it possible to make it.

注意:此应用仅供内部使用.不会在应用商店中发布.

Note: This app is for internal purpose. Not going to post in app store.

推荐答案

如果要在下面的方法中截取屏幕截图,可以返回图像:

If you want to take a screenshot below method can you returning an image:

-(UIImage *) takeScreenshot{
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, 0);
    [self.view drawViewHierarchyInRect:self.view.bounds afterScreenUpdates:YES];
    UIImage *screenshot = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return screenshot;
}

这篇关于如何从后台应用程序获取运行iPhone的屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆