如何拍摄整个视图的iPhone屏幕截图,包括屏幕外的部分? [英] How to take an iPhone screenshot of entire view including parts off screen?

查看:178
本文介绍了如何拍摄整个视图的iPhone屏幕截图,包括屏幕外的部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用UITableView布局的应用程序。界面占用的不仅仅是屏幕,所以有一些区域可以滚动到。我想要整个视图(包括不可见区域)的屏幕截图用于文档和征求我的客户的反馈。

I have an application that's laid out using an UITableView. The interface takes up more than just the screen, so there's some area that can be scrolled to. I would like some screenshots of the entire view (including the non-visible area) to use for documentation and soliciting feedback from my customer.

有编程方式形象的整个视图?我不认为在设备上会有办法做到这一点,但也许有。

Is there programmatic way to get an image of the entire view? I don't think there would be a way on the device to do this, but maybe there is.

推荐答案

代码我在我的应用程序中使用。它绘制一个图像的视图(潜在缩放)。
也许你可以用程序设计滚动表格并将图像拼接在一起或类似的东西:

Just pasting some code I used in my app. It draws a view to an image (potentially scaling). Maybe you could programmaticaly scroll the table and stitch the images together in the end or something similar:

+ (UIImage *)captureView: (UIView *)view inSize: (CGSize)size
{
    UIGraphicsBeginImageContext(size);
    CGSize viewSize = view.frame.size;
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextScaleCTM( context, size.width/viewSize.width, size.height/viewSize.height);

    [view.layer renderInContext: UIGraphicsGetCurrentContext()];

    UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return viewImage;
}

希望它有帮助

这篇关于如何拍摄整个视图的iPhone屏幕截图,包括屏幕外的部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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