views:

34

answers:

1

Hi, 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.

+1  A: 

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();
spin-docta
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 tableViewResult : 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.
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.
spin-docta