ios - Capture off screen content as UIImage in iOS7 -
I have a UIView inside the UIScrollView that is much more than the screen. My code looks like this
UIView * contentView = [[UIView alloc] initWithFrame: CGRectMake (0.0f, -500.0f, 320.0f, 2000.0f)]; [_scrollView with view: contentView];
and I want to capture an image of the contents
// screen capture UIGraphicsBeginImageContextWithOptions (contentView.frame.size, NULL, 0.0f); [Self.view drawViewHierarchyIncrease: contentView.boundsScreenUpdates: no]; UIImage * viewImage = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext ();
The above code works on simulators but not on the actual device (iPod 5G Gen)
If I capture scrollView instead of contentView, it works fine Does, but only what is captured on the screen will be captured. Any ideas?
Use ScrollView Content Offset
. To get a frame of view, which is currently on the screen
Comments
Post a Comment