Skip to content

Commit

Permalink
If the client has iOS7, uses the new |drawViewHierarchyInRect:afterSc…
Browse files Browse the repository at this point in the history
…reenUpdates:| method in NISnapshotRotation, which renders UIDatePickers in iOS7 correctly.
  • Loading branch information
Joe Turner committed Apr 19, 2014
1 parent effd15c commit 5325bd0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/src/NISnapshotRotation.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@
// that is currently in the frame, so we offset by the bounds of the view accordingly.
CGContextTranslateCTM(cx, -view.bounds.origin.x, -view.bounds.origin.y);

[view.layer renderInContext:cx];
BOOL didDraw = NO;
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= NIIOS_7_0
if ([view respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
didDraw = [view drawViewHierarchyInRect:view.bounds afterScreenUpdates:YES];
}
#endif
if (!didDraw) {
[view.layer renderInContext:cx];
}

UIImage* image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Expand Down

0 comments on commit 5325bd0

Please sign in to comment.