您的位置:首页 > 其它

SYBarcodeManager二维码的扫描与生成

2017-09-22 14:17 176 查看
SYBarcodeManager



代码示例

// 导入头文件
#import "SYBarcodeManager.h"

// 实例化
SYBarcodeManager *scanningBarcode = [[SYBarcodeManager alloc] init];

// 属性设置
scanningBarcode.scanRadius = 50.0;
scanningBarcode.showScanline = YES;
scanningBarcode.scanlineColor = [UIColor redColor];
scanningBarcode.showScanCorner = YES;
scanningBarcode.scanCornerColor = [UIColor greenColor];

// 方法调用

// 首次调用扫描二维码
[scanningBarcode barcodeScanningWithFrame:CGRectMake(60.0, (CGRectGetHeight(self.view.bounds) - (CGRectGetWidth(self.view.bounds) - 60.0 * 2)) / 2, (CGRectGetWidth(self.view.bounds) - 60.0 * 2), (CGRectGetWidth(self.view.bounds) - 60.0 * 2)) view:self.view complete:^(NSString *scanResult) {
[[[UIAlertView alloc] initWithTitle:nil message:scanResult delegate:nil cancelButtonTitle:nil otherButtonTitles:@"ok", nil] show];
}];

// 停止扫描二维码
[scanningBarcode barcodeScanningCancel];

// 重新扫描二维码
[scanningBarcode barcodeScanningStart];




代码示例

// 指定大小和颜色
CGFloat width = (CGRectGetWidth(self.view.bounds) - 10.0 * 2);
UIImage *image = [SYBarcodeManager barcodeImageWithContent:@"https://github.com/potato512/BarcodeManager" size:width colorRed:10.0 colorGreen:100.0 colorBlue:50.0];

// 指定大小
CGFloat width = (CGRectGetWidth(self.view.bounds) - 10.0 * 2);
UIImage *image = [SYBarcodeManager barcodeImageWithContent:@"https://github.com/potato512/BarcodeManager" size:width];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  二维码