I know there are many questions about this theme but I really read all of them but
not found an answer.
I want make a screenshot from the current table view. and i do it this way:
-(UIImage *)imageFromCurrentView
{
UIGraphicsBeginImageContextWithOptions(self.tableView.bounds.size, YES, 1);
[self.tableView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return img;
}
Everything works fine, but when i scroll down in the tableview and make the screenshot,
half of the image is black. I don’t know how to make the screenshot from the actual
tableview area.
Because UITableViewCell is reusable, when scrolling the table view, the cells outside the view ports will be enqueued for reusing and removed from the table view. So try to keep the cells only be reusable on its index path:
Not tested yet, give it a try. Yes, this will consume much more memory, do it with screenshot purpose only.
Edit: if you care the memory usage, may be you can take screenshot of current view port, then programmatically scroll top and down to take other parts of screenshots, and combine all the screen shots at last.