Giter Club home page Giter Club logo

zzyqrcode's Introduction

ZZYQRCode

使用系统API(AVFoundation)进行封装,包含UI界面以及对二维码,条形码进行扫描,生成等操作

如何使用

  1. 创建sessionManager,同时需要设置扫描类型、扫描区域等
- (instancetype)initWithAVCaptureQuality:(AVCaptureQuality)quality
                           AVCaptureType:(AVCaptureType)type
                                scanRect:(CGRect)scanRect
                            successBlock:(SuccessBlock)success;
  1. 显示View
- (void)showPreviewLayerInView:(UIView *)view;

附加功能

  1. 扫描音效
@property(assign, nonatomic) BOOL isPlaySound;

@property(copy, nonatomic) NSString *soundName;
  1. 开启闪光灯
- (void)turnTorch:(BOOL)state;
  1. 扫描相册中的二维码
- (void)scanPhotoWith:(UIImage *)image successBlock:(SuccessBlock)success;
  1. 权限监测
+ (void)checkAuthorizationStatusForCameraWithGrantBlock:(void(^)())grant
                                            DeniedBlock:(void(^)())denied;
  1. 创建普通二维码
UIImage *image = [UIImage createQRCodeWithSize:200 dataString:@"hello"];
  1. 自定义二维码
UIImage *icon = [UIImage imageNamed:@"bigMax"];
UIImage *image = [UIImage createQRCodeWithSize:200
                                    dataString:@"hello"
                               QRCodeImageType:circularImage
                                     iconImage:icon
                                 iconImageSize:40];

注意事项

由于iOS10权限设置变换,需要在项目中的info.plist文件中添加如下文件

<key>NSCameraUsageDescription</key>
<string></string>
<key>NSPhotoLibraryUsageDescription</key>
<string></string>

页面效果

zzyqrcode's People

Watchers

James Cloos avatar Carabineiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.