Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Create QR code
var imageView = new UIImageView ();
imageView.Frame = UIScreen.MainScreen.Bounds;
imageView.ContentMode = UIViewContentMode.ScaleAspectFit;
var qrCode = new CIQRCodeGenerator {
Message = NSData.FromString ("test"),
CorrectionLevel = "Q"
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.