To run the example project, clone the repo, and run pod install
from the Example directory first.
QRCodeScan is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'QRCodeScan'
#import "HY_QRCodeScan.h"
/**
* 扫码类型
* HY_ScanTypeQrCode,
* HY_ScanTypeBarCode,
* HY_ScanTypeAll,
*/
HY_ScanViewController *scanVc = [[HY_ScanViewController alloc] initWithQrType:HY_ScanTypeAll onFinish:^(NSString *result, NSError *error) {
if (error) {
NSLog(@"error: %@",error);
} else {
NSLog(@"扫描结果:%@",result);
[self showInfo:result];
}
}];
[self.navigationController pushViewController:scanVc animated:YES];
///生成二维码
UIImage *QRCodeImage = [HY_ScanCodeTool createQRImageWithString:self.qrText.text QRSize:CGSizeMake(128, 128) QRColor:[UIColor purpleColor] bkColor:[UIColor blackColor]];
///生成条形码
UIImage *barCodeImage = [HY_ScanCodeTool createBarCodeImageWithString:self.qrText.text barSize:CGSizeMake(200, 80)];
///识别二维码
[HY_ScanCodeTool recognizeQrCodeImage:imageView.image onFinish:^(NSString * _Nonnull result) {}];
Baffin-HSL, [email protected]
QRCodeScan is available under the MIT license. See the LICENSE file for more info.