Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Create QR code

View gist:b784ab08889d83fb0a43
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
var imageView = new UIImageView ();
imageView.Frame = UIScreen.MainScreen.Bounds;
imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
 
var qrCode = new CIQRCodeGenerator {
Message = NSData.FromString ("test"),
CorrectionLevel = "Q"
}.OutputImage;
 
UIGraphics.BeginImageContext (new SizeF (qrCode.Extent.Width * 8, qrCode.Extent.Height * 8));
var cgCtx = UIGraphics.GetCurrentContext ();
var ciCtx = CIContext.FromOptions (null);
cgCtx.InterpolationQuality = CGInterpolationQuality.None;
cgCtx.DrawImage (cgCtx.GetClipBoundingBox (), ciCtx.CreateCGImage (qrCode, qrCode.Extent));
using (var image = UIGraphics.GetImageFromCurrentImageContext ()) {
imageView.Image = image;
}
UIGraphics.EndImageContext ();
View.AddSubview (imageView);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.