iOS 7 Core Image QR Code generation too blur

前端 未结 8 1570
心在旅途
心在旅途 2020-12-24 02:44

here\'s my code for generating QRCode image

+ (UIImage *)generateQRCodeWithString:(NSString *)string {
    NSData *stringData = [string dataUsingEncoding:NSU         


        
8条回答
  •  再見小時候
    2020-12-24 03:20

    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

提交回复
热议问题