CDZQRScanView.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // ONEQRScanView.h
  3. // Pods
  4. //
  5. // Created by Nemocdz on 2017/5/2.
  6. //
  7. //
  8. #import <UIKit/UIKit.h>
  9. @class CDZQRScanView;
  10. @protocol CDZQRScanDelegate<NSObject>
  11. @required
  12. /**
  13. 扫描有结果回调方法,如需结束在回调里调用stopScanning方法
  14. @param scanView 回调的View
  15. @param message 结果字符串
  16. */
  17. - (void)scanView:(CDZQRScanView *)scanView pickUpMessage:(NSString *)message;
  18. @end
  19. @interface CDZQRScanView : UIView
  20. @property (nonatomic, weak) id<CDZQRScanDelegate> delegate;
  21. /**
  22. 扫描区域的Frame,默认长宽为Frame的宽度3/4,位置为Frame中心
  23. */
  24. @property (nonatomic, assign) CGRect scanRect;
  25. /**
  26. 第一次调用会初始化相机相关并开始扫描
  27. 之后调用,可在暂停后恢复
  28. */
  29. - (void)startScanning;
  30. /**
  31. 暂停扫描
  32. */
  33. - (void)stopScanning;
  34. /**
  35. 开启/关闭闪光灯
  36. */
  37. - (void)changeTorch;
  38. /**
  39. 可自定义的蒙版View,可在上面添加自定义控件,也可以改变背景颜色,透明度
  40. 默认为50%透明度黑色,遮盖区域依赖scanRect,需先指定scanRect,否则为默认
  41. */
  42. @property (nonatomic, strong) UIView *maskView;
  43. /**
  44. 上下移动的扫描线的颜色,默认为橙色
  45. */
  46. @property (nonatomic, strong) UIColor *scanLineColor;
  47. /**
  48. 四角的线的颜色,默认为橙色
  49. */
  50. @property (nonatomic, strong) UIColor *cornerLineColor;
  51. /**
  52. 扫描边框的颜色,默认为白色
  53. */
  54. @property (nonatomic, strong) UIColor *borderLineColor;
  55. /**
  56. 是否显示上下移动的扫描线,默认为YES
  57. */
  58. @property (nonatomic, assign, getter=isShowScanLine) BOOL showScanLine;
  59. /**
  60. 是否显示边框,默认为NO
  61. */
  62. @property (nonatomic, assign, getter=isShowBorderLine) BOOL showBorderLine;
  63. /**
  64. 是否显示四角,默认为YES
  65. */
  66. @property (nonatomic, assign, getter=isShowCornerLine) BOOL showCornerLine;
  67. @end