Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/UIKit/UIScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,18 @@ public XamCore.CoreAnimation.CADisplayLink CreateDisplayLink (NSAction action)

public UIImage Capture ()
{
if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
// This is from https://developer.apple.com/library/content/qa/qa1817/_index.html
try {
var view = UIApplication.SharedApplication.KeyWindow;
UIGraphics.BeginImageContextWithOptions (view.Bounds.Size, view.Opaque, 0);
view.DrawViewHierarchy (view.Bounds, true);
return UIGraphics.GetImageFromCurrentImageContext ();
} finally {
UIGraphics.EndImageContext ();
}
}

// This is from: https://developer.apple.com/library/ios/#qa/qa2010/qa1703.html
var selScreen = new Selector ("screen");
var size = Bounds.Size;
Expand Down