Code Monkey home page Code Monkey logo

mqrcodereaderviewcontroller's Introduction

English Guide

说明

MQRCodeReaderViewController 基于 QRCodeReaderViewController 封装的二维码扫描控件, 仿照微信的二维码扫描器风格美化了界面, 直接加入你的项目中就能使用, 无需再次定制 UI.

Made with ❤️ by The EST Group - We design and build: the Future!

screenshot

安装

CocoaPods 安装

将下面代码复制进你的 Podfile 文件中

pod 'QRCodeReaderViewController', :git => 'https://github.com/zhengjinghua/MQRCodeReaderViewController.git'

手工安装

下载 此项目, 然后将该项目里的 QRCodeReaderViewController 文件夹里的所有文件复制进你的项目中, 然后在需要调用此项目的地方引入

#import "QRCodeReaderViewController.h"

使用

支持以下两种方法调用, 选其一, 代码见下面:

  • 使用 Delegate 方法调用;
  • 使用 Block 方法调用;
- (IBAction)scanAction:(id)sender
{
	NSArray *types = @[AVMetadataObjectTypeQRCode];
  	_reader        = [QRCodeReaderViewController readerWithMetadataObjectTypes:types];
  
  	// Using delegate methods
  	_reader.delegate = self;
  
  	// Or by using blocks
  	[_reader setCompletionWithBlock:^(NSString *resultAsString) {
    	[self dismissViewControllerAnimated:YES completion:^{
      		NSLog(@"%@", resultAsString);
    	}];
  	}];
  
  	[self presentViewController:_reader animated:YES completion:NULL];
}

#pragma mark - QRCodeReader Delegate Methods

- (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result
{
  	[self dismissViewControllerAnimated:YES completion:^{
   		 NSLog(@"%@", result);
  	}];
}

- (void)readerDidCancel:(QRCodeReaderViewController *)reader
{
  	[self dismissViewControllerAnimated:YES completion:NULL];
}

协议

MQRCodeReaderViewController 被许可在 MIT 协议下使用. 查阅 LICENSE 文件来获得更多信息.

README (ENGLISH)

Description

This projecd baesd on QRCodeReaderViewController, a little UI ajustment from QRCodeReaderView, make the interface more like WeChat.

Made with ❤️ by The EST Group - We design and build: the Future!

Install

CocoaPods

If you're using CocoaPods (You are not?! You should!!) just add

pod 'QRCodeReaderViewController', :git => 'https://github.com/zhengjinghua/MQRCodeReaderViewController.git'

into your Podfile file.

Manually

Download the project and copy the QRCodeReaderViewController folder into your project and then simply #import "QRCodeReaderViewController.h" in the file(s) you would like to use it in.

Usage

- (IBAction)scanAction:(id)sender
{
	NSArray *types = @[AVMetadataObjectTypeQRCode];
  	_reader        = [QRCodeReaderViewController readerWithMetadataObjectTypes:types];
  
  	// Using delegate methods
  	_reader.delegate = self;
  
  	// Or by using blocks
  	[_reader setCompletionWithBlock:^(NSString *resultAsString) {
    	[self dismissViewControllerAnimated:YES completion:^{
      		NSLog(@"%@", resultAsString);
    	}];
  	}];
  
  	[self presentViewController:_reader animated:YES completion:NULL];
}

#pragma mark - QRCodeReader Delegate Methods

- (void)reader:(QRCodeReaderViewController *)reader didScanResult:(NSString *)result
{
  	[self dismissViewControllerAnimated:YES completion:^{
   		 NSLog(@"%@", result);
  	}];
}

- (void)readerDidCancel:(QRCodeReaderViewController *)reader
{
  	[self dismissViewControllerAnimated:YES completion:NULL];
}

License

StitchingImage is available under the MIT license. See the LICENSE file for more info.


mqrcodereaderviewcontroller's People

Contributors

summerblue avatar zhengjinghua avatar

Stargazers

 avatar

Watchers

 avatar  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.