CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.

LYSQRCodeView 0.0.1

LYSQRCodeView 0.0.1

Maintained by liyangshuai.



  • By
  • LIYANGSHUAI

LYSQRCode

简单实现扫描二维码,条形码,以及生成二维码的工具

iOS技术群群二维码

@interface LYSQRCodeView : UIView

// 代理
@property (nonatomic, assign) id<LYSQRCodeViewDelegate> delegate;

/**
扫描识别类型

默认是
AVMetadataObjectTypeEAN13Code,
AVMetadataObjectTypeEAN8Code,
AVMetadataObjectTypeCode128Code, // 条形码
AVMetadataObjectTypeQRCode       // 二维码
*/
@property (nonatomic, copy, null_resettable) NSArray<AVMetadataObjectType> *metadataObjectTypes;

// 活跃区域,区域内可检测二维码,区域外不可检测,默认LYSQRCodeView的bounds作为活跃区域
@property (nonatomic, assign) CGRect activeAreaRect;

// 默认AVCaptureSessionPresetHigh
@property(nonatomic, copy) AVCaptureSessionPreset sessionPreset;

// 初始化核心组件
- (void)initialization;

// 开始扫描
- (void)startScan;
// 停止扫描
- (void)stopScan;

// 识别图片中二维码
- (void)identificationCodeWithImg:(UIImage *)image callBack:(void(^)(NSString *message))callback;

// 开启闪光灯
- (void)openFlashlight;
// 关闭闪光灯
- (void)closeFlashlight;

@end
@class LYSQRCodeView;

@protocol LYSQRCodeViewDelegate <NSObject>

@required
- (void)qrView:(LYSQRCodeView *)qrView didOutputMetadataObjects:(NSArray<__kindof AVMetadataObject *> *)metadataObjects;

@optional
- (void)qrViewDidStartScan:(LYSQRCodeView *)qrView;
- (void)qrViewDidStopScan:(LYSQRCodeView *)qrView;
- (void)notHaveFlashlight;
@end