I'd like to render a basic UIListView into an image I can save. I found lots of code here for rendering a UIView to an image (for iphone/iPod Touch). In fact, the code below is what I pulled from other posts and am using now. Problem is it doesn't draw anything from the UIListView which isn't visible when the method is invoked.
- (void)snapShotAction:(id)sender
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext(screenRect.size);
CGContextRef ctx = UIGraphicsGetCurrentContext();
[[UIColor blackColor] set];
CGContextFillRect(ctx, screenRect);
//[self.view.layer renderInContext:ctx];
[self.myTableView.layer renderInContext:ctx];
UIImage *screenImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
UIImageWriteToSavedPhotosAlbum(screenImage, nil, nil, nil);
}
So I'd like the flexibility of being able to force the entire UIListView to render (including offscreen rows) to an image, but if no one has some insight for making that happen, I guess my alternative is to create an image or graphicscontext and just render a facsimile of the list manually (and any references to sample code for doing that are appreciated).
Here's another idea that occurred to me. Perhaps I can use a separate UITableView with no bottom or top bars (to maximize horizontal space) then calculate the row heights based on the number of items in the table then use the code above to capture that. Of course there will be limits to how many items the list can have before the text size is too small to be usable...