views:

68

answers:

1

I need to capture a UIView and all it's subviews into a UIImage. The problem is that part of the view is off screen, so I can't use the screen capture function, and when I try to use the UIGraphicsGetImageFromCurrentImageContext() function, it doesn't seem to capture the subviews as well. Should it be capturing the subviews and I'm just doing something wrong? If not, is there any other way of accomplishing this?

A: 

Do you mean

UIGraphicsBeginImageContext(view.bounds.size);
[view.layer drawInContext:UIGraphicsGetCurrentContext()];
UIImage * img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

doesn't work? I'm pretty sure it ought to...

tc.