繁体   English   中英

iOS 对tableview进行截图

[英]iOS taking a screenshot of tableview

所以我正在创建一个 iPad 应用程序,我需要在其中截取表格视图并稍后显示,类似于 iPad safari 选项卡页面。 我需要在两个方向上截取屏幕截图而不实际改变方向。 我怎样才能归档这个?

您所描述的超出了任何“屏幕截图”的限制。 您将需要手动生成表格视图的图像。 如果视图很简单(即一些文本、分隔符等),您可以使用 CoreGraphics 或类似的东西从头开始绘制图像。 我维护了一个名为ANImageBitmapRep的开源 class,它允许轻松进行像素级和上下文级图像操作。 在这种情况下,您很可能会使用核心图形,但首先是生成上下文的方式:

ANImageBitmapRep * irep = [[ANImageBitmapRep alloc] initWithSize:BMPointMake(myWidth, myHeight)];
CGContextRef context = [irep context];
// ...
// use context here to manually generate your "screenshot."
// ...
[irep setNeedsUpdate]; // tell the image bitmap rep to update its image
UIImage * savedImage = [irep image]; // get a UIImage for storing
[irep release]; // free the memory

可以在http://idevhub.com/exploring-iphone-graphics-part-1/找到有关使用 CoreGraphics 绘图的小教程。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM