Created
July 31, 2015 21:50
-
-
Save ozzieperez/85cf1d0bad627a6ab928 to your computer and use it in GitHub Desktop.
Xamarin IOS - Returns a UIView as a UIImage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UIImage AsImage(this UIView view) | |
{ | |
UIGraphics.BeginImageContextWithOptions(view.Bounds.Size, true, 0); | |
view.Layer.RenderInContext(UIGraphics.GetCurrentContext()); | |
var img = UIGraphics.GetImageFromCurrentImageContext(); | |
UIGraphics.EndImageContext(); | |
return img; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment