SYBarcodeManager二维码的扫描与生成

SYBarcodeManager

扫描二维码


效果图

代码示例

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

// 实例化
SYBarcodeManager *scanningBarcode = [[SYBarcodeManager alloc] initWithFrame:self.view.bounds view:self.view];

// 属性设置
scanningBarcode.maskColor = [UIColor orangeColor];
scanningBarcode.scanlineColor = [UIColor redColor];
scanningBarcode.scanCornerColor = [UIColor greenColor];
scanningBarcode.scanFrame = CGRectMake(60.0, 100.0, 80.0, 80.0);

// 开始扫描
[scanningBarcode barcodeScanningStart:^(NSString *scanResult) {
        NSLog(@"scanResult = %@", scanResult);
        [[[UIAlertView alloc] initWithTitle:nil message:scanResult delegate:nil cancelButtonTitle:nil otherButtonTitles:@"ok", nil] show];
}];

// 结束扫描
[scanningBarcode barcodeScanningCancel]; 

生成二维码

SYBarcodeManager二维码的扫描与生成_第1张图片
效果图

代码示例

// 指定大小和颜色
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];

你可能感兴趣的:(SYBarcodeManager二维码的扫描与生成)