zjf
2023-03-06 392b76515f40376b6d36f40a114850ef63650384
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
//  SGScanCode.h
//  SGQRCodeExample
//
//  Created by kingsic on 2016/8/16.
//  Copyright © 2016年 kingsic. All rights reserved.
//
 
#import <UIKit/UIKit.h>
#import "SGScanCodeDelegate.h"
 
@interface SGScanCode : NSObject
/// 类方法创建
+ (instancetype)scanCode;
 
/// 预览视图,必须设置(传外界控制器视图)
@property (nonatomic, strong) UIView *preview;
 
/// 扫描区域,以屏幕右上角为坐标原点,取值范围:0~1,默认为整个屏幕
@property (nonatomic, assign) CGRect rectOfInterest;
 
/// 扫描二维码数据代理
@property (nonatomic, weak) id<SGScanCodeDelegate> delegate;
 
/// 采样缓冲区代理
@property (nonatomic, weak) id<SGScanCodeSampleBufferDelegate> sampleBufferDelegate;
 
 
/// 读取图片中的二维码
///
/// @param image            图片
/// @param completion       回调方法,读取成功时,回调参数 result 等于二维码数据,否则等于 nil
- (void)readQRCode:(UIImage *)image completion:(void (^)(NSString *result))completion;
 
/// 设置视频缩放因子(捕获内容)
- (void)setVideoZoomFactor:(CGFloat)factor;
 
/// 检测后置摄像头是否可用
- (BOOL)checkCameraDeviceRearAvailable;
 
/// 开启扫描
- (void)startRunning;
/// 停止扫描
- (void)stopRunning;
 
/// 播放音效
- (void)playSoundEffect:(NSString *)name;
 
@end