Friday 7 October 2016

QRCodeReader in Objective-c

QRCodeReader framework help to Decode QRcode.

QRCodeReader Framework for ios developer, Very eazy implementation with delegate.

CocoaControls Link : https://www.cocoacontrols.com/controls/qrcodereader



How to use
1. Embeded Binaries

2. Drag and drop UIView in your view controller.
3. Change Class of UIVIew.
4. Bind your UIView.

Paste "M1, M2" methods in your view controller (i.e. "ViewController.m")

"M1" viewDidLoad

- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.title = @"QR Code Reader";
[qrCodeView setDelegate:self];
[qrCodeView startReading];
}
And here the delegate methods:

"M2" QRCodeReaderDelegate

#pragma mark - QRCodeReaderDelegate
- (void)getQRCodeData:(id)qRCodeData {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"QR Code" message:qRCodeData preferredStyle:UIAlertControllerStyleAlert];

UIAlertAction *cancel = [UIAlertAction actionWithTitle:@"Close" style:UIAlertActionStyleDefault handler:nil];
[alertController addAction:cancel];

UIAlertAction *reScan = [UIAlertAction actionWithTitle:@"Rescan" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
[qrCodeView startReading];
}];
[alertController addAction:reScan];
[self presentViewController:alertController animated:YES completion:nil];
}

No comments:

Post a Comment