0

i have a UIView having 3 UITableView and need to take screen shot. But problem is invisible part of the 3 tables . Can anyone help to find a way to take screen shot of the whole view including complete scrolled contents of the tables.

  • Do you want to take a screenshot from your computer, or have the image rendered in the app itself? – jtbandes Jul 25 '10 at 23:58
  • You can use this [sample code](http://stackoverflow.com/questions/2328201/how-to-take-an-iphone-screenshot-of-entire-view-including-parts-off-screen/8033794#8033794) to get full view of tableview. – Zitao Xiong Nov 07 '11 at 07:52

1 Answers1

1

This helps get the contents of a layer (ie. and thus a UIView)

UIGraphicsBeginImageContext(tableView.frame.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[tableView.layer renderInContext:ctx];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
devinross
  • 2,816
  • 6
  • 34
  • 34
  • hi thanks very much for your answer and time. I actually need to take screen shot of all the tables with their visible and invisible parts including other parts of the self.view. I have tried your code with self.table2 in place of tableView Result : Shows only table2 visible part. Tried with self.view also. Result : Shows the view with table1.table2,table3 having their visible parts only. But not showing the invisible parts of those 3 tables. thanks again and appreciate your effort. – user401827 Jul 29 '10 at 04:30
  • 1
    The cells off screen are technically draw on the view (for good reasons). So you'd have to create a loop to take the image and then scroll the tableview down. Then you'd probably need to patch the images. – devinross Oct 15 '10 at 20:50