How to screen-shot ALL content of tableView? (all content = visible are + NOT visible area)
I tried this:
UIGraphicsBeginImageContext(self.tableView.
+ (UIImage *)captureView:(UIScrollView *)view inContentRect:(CGRect)rect{
UIImage* image = nil;
CGPoint savedContentOffset = view.contentOffset;
CGRect savedFrame = view.frame;
UIGraphicsBeginImageContextWithOptions(view.contentSize, 1, 0);
view.contentOffset = CGPointZero;
view.frame = CGRectMake(0, 0, view.contentSize.width, view.contentSize.height);
[view.layer renderInContext: UIGraphicsGetCurrentContext()];
image = UIGraphicsGetImageFromCurrentImageContext();
view.contentOffset = savedContentOffset;
view.frame = savedFrame;
UIGraphicsEndImageContext();
// after all of this, crop image to needed size
return [Utils cropImage:image toRect:rect];
}
You have to use contentSize.height
for getting the height of tableview
Try this
UIGraphicsBeginImageContext(self.tableView.contentSize.height);
[self.tableView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage* image1 = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
self.imageView.image = image1;
Yes, you can do this. I can't provide the working code for what you want, I can just guide you how to do this. In the loop you have to get renders of all parts of the table by changing it's contentOffset
and place each image in the array. After you got all the portions of the table view, you have to connect the parts of the table in to one image (draw each image in cgimagecontext, remember to set correct size for the result image). That's it, it's not that hard :) Hope this helps, Good luck!