I have a UIView within UIScrollView which is much higher than the screen. My code looks like this
UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, -500.0f, 320.0f, 2000.0f)];
[_scrollView addSubview:contentView];
and I want to capture an image of contentView
//Screen capture.
UIGraphicsBeginImageContextWithOptions(contentView.frame.size, NULL, 0.0f);
[self.view drawViewHierarchyInRect:contentView.bounds afterScreenUpdates:NO];
UIImage* viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
The above code works on simulator but not on actual device (iPod 5th gen)
If I capture the scrollView instead of contentView, it works ok, but only what's displayed on the screen will be captured. Any ideas?
Well, I reckon this may not be possible, as iOS won't draw off screen contents in order to gain more performance and battery life.