Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to generate QR code image on iOS

Tags:

ios

qr-code

Is there a standard way to generate a QR code and attach it to a mail item from iOS client app (no server code)?

like image 603
user1561181 Avatar asked Aug 21 '12 08:08

user1561181


People also ask

Can iOS generate a QR code?

While there is no built-in tool to create a QR code on iOS, plenty of third-party apps are available that can do the job. We'll be using the free QRbot app. You could also use any other popular QR Reader app since they usually come with features that let you make your own QR codes.

How do I create a QR code for a picture on my iPhone?

Tap Icon Size, then choose 128X128p or Custom, then manually type the height and height of the logo or image file in the QR code. Tap on Create button at the bottom, the custom QR code with logo, signature or image in the middle will be created instantly.

Can we generate QR code for image?

Yes, you can create a QR code for a picture using QRTIGER QR code generator online by following the instructions above.


2 Answers

Since iOS 7, you can use a Core Image filter to generate QR images. See the final tip here:

- (CIImage *)createQRForString:(NSString *)qrString {     NSData *stringData = [qrString dataUsingEncoding: NSISOLatin1StringEncoding];      CIFilter *qrFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"];     [qrFilter setValue:stringData forKey:@"inputMessage"];      return qrFilter.outputImage; } 
like image 85
quarac Avatar answered Oct 02 '22 13:10

quarac


For Obj-C version that perfectly works for me, I've mixed answers पवन and Teja Kumar Bethina:

NSString *qrString = @"My string to encode"; NSData *stringData = [qrString dataUsingEncoding: NSUTF8StringEncoding];  CIFilter *qrFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"]; [qrFilter setValue:stringData forKey:@"inputMessage"]; [qrFilter setValue:@"H" forKey:@"inputCorrectionLevel"];  CIImage *qrImage = qrFilter.outputImage; float scaleX = self.qrImageView.frame.size.width / qrImage.extent.size.width; float scaleY = self.qrImageView.frame.size.height / qrImage.extent.size.height;  qrImage = [qrImage imageByApplyingTransform:CGAffineTransformMakeScale(scaleX, scaleY)];  self.qrImageView.image = [UIImage imageWithCIImage:qrImage                                              scale:[UIScreen mainScreen].scale                                        orientation:UIImageOrientationUp]; 
like image 36
Mike Demidov Avatar answered Oct 02 '22 12:10

Mike Demidov