Home

Awesome

<p align="center"> <br>  <b>创造不息,交付不止</b> <br> <a href="https://www.yousails.com"> <img src="https://yousails.com/banners/brand.png" width=350> </a> </p>

English Guide

说明

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

Made with :heart: 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"

使用

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

- (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 :heart: 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.