1
我想为所有单元格数量的屏幕截图查看不仅适用于可见单元格的单元格。行数是动态的。TableView的屏幕截图不仅适用于可见单元格,而且适用于所有可用单元格
如果有30行,那么我想在一个屏幕截图中的所有30行。 我已经使用的tableview的总高度尝试作为
self.tblView.contentSize.height
与此代码I M获得所有细胞的屏幕,但除了明显的细胞屏幕的所有其他部分是空白。
我使用下面的代码采取截屏
- (UIImage *)captureView:(UIView *)view
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
screenRect.size.height=self.tblView.contentSize.height;
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);
[view.layer renderInContext:ctx];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
感谢您的帮助。
我认为这是更复杂的,只是因为细胞没有被淹没拍摄屏幕截图。 – 2012-07-13 13:51:46
@Alex Terente,有没有其他方法可以捕获所有细胞? – Nikunj 2012-07-13 13:53:45
您可以在CGContext中绘制所有东西,并从该上下文中获取图像。 – 2012-07-13 14:01:19