Based on http://stackoverflow.com/questions/12051118/is-there-a-way-to-generate-qr-code-image-on-ios
Code:
Code:
B4X:
Dim NativeMe As NativeObject = Me
NativeMe.RunMethod("createQRForString::", Array ("Your text",ImageView1))
#If OBJC
- (void)createQRForString:(NSString *)qrString :(UIImageView *)qrImageView
{
// Need To convert the string To a UTF-8 encoded NSData object
NSData *stringData = [qrString dataUsingEncoding: NSISOLatin1StringEncoding];
// Create the filter
CIFilter *qrFilter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
// Set the message content And error-correction level
[qrFilter setValue:stringData forKey:@"inputMessage"];
[qrFilter setValue:@"M" forKey:@"inputCorrectionLevel"];
// Remove blur effect with scaling
CGAffineTransform transform = CGAffineTransformMakeScale(100.0f,100.0f);
CIImage *qrOutput = [qrFilter.outputImage imageByApplyingTransform: transform];
//Convert CIImage to UIImage
UIImage *qrImage = [[UIImage alloc] initWithCIImage:qrOutput];
//Set Image to ImageView
[qrImageView setImage:qrImage];
}
#End If