QRCodeReaderViewController二维码扫描组件
QRCodeReaderViewController 是一个用于 iOS 7 的二维码扫描组件。
使用方法:
- (IBAction)scanAction:(id)sender { QRCodeReaderViewController *reader = [QRCodeReaderViewController new]; reader.modalPresentationStyle = UIModalPresentationFormSheet; // Using delegate methods reader.delegate = self; // Or by using blocks [reader setCompletionWithBlock:^(NSString *resultAsString) { [self dismissViewControllerAnimated:YES completion:^{ NSLog(@"%@", result); }]; }]; [self presentViewController:reader animated:YES completion:NULL]; } #pragma mark - QRCodeReader Delegate Methods - (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result { [self dismissViewControllerAnimated:YES completion:^{ NSLog(@"%@", result); }]; } - (void)readerDidCancel:(QRCodeReaderViewController *)reader { [self dismissViewControllerAnimated:YES completion:NULL]; }
评论