here's my code for generating QRCode image
+ (UIImage *)generateQRCodeWithString:(NSString *)string {
NSData *stringData = [string dataUsingEncoding:NSUTF8StringEncoding];
CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
[filter setValue:stringData forKey:@"inputMessage"];
[filter setValue:@"M" forKey:@"inputCorrectionLevel"];
return [UIImage imageWithCIImage:filter.outputImage];
}
The result is too blur. Is it possible to set the size of the generated qr code?
Easiest solution is to add following to your image view:
imgViewQR.layer.magnificationFilter = kCAFilterNearest
This will automatically upscale your generated QR code image to imageview's size using nearest
which results in sharp, pixelated image. This usually isn't what you want when resizing icons/photos but is perfect for QR codes
(it doesn't seem to work on simulator but works great on real device