IOS8 Two-dimensional code scanning-qrcodereaderviewcontroller

Source: Internet
Author: User

A moment to download

Project Address:

Https://github.com/yannickl/QRCodeReaderViewController

The official introduction of the QRCode can specify the encoding, especially it supports ios7+, which can be used to replace zxing, Zbar. I started using Zbar at the beginning of the project, and normally it was normal, but when scanning a very small QR code, it was not recognized. After switching to QRCode, the recognition effect is quite good.

It will provide a default view controller call camera and will provide a button to toggle the front camera and rear camera.

This is the official screenshot:


The recommended installation method for installation is to use the Cocoapods package management tool. In the Podfile file, enter:
$CD/path/to/myproject$ Touch podfile$ Vim PodfileSource  'https://github.com/CocoaPods/Specs.git' Platform:ios, '7.0' Pod 'qrcodereaderviewcontroller' , '~> 3.4.0' 
Then execute on the command line: Pod Install
After you wait for the installation to finish, enter open ****.xcworkspace.
Using the header file:
  viewcontroller.h//  smarthome////  Created by Xie Han Festival on 15/5/14.//  Copyright (c) 2015 WHR. All rights reserved.//#import <UIKit/UIKit.h> #import "QRCodeReaderViewController.h" @interface Viewcontroller: Uiviewcontroller<qrcodereaderdelegate> @end


. m File:
#import "QRCodeReaderViewController.h"

-(void) actionscan{nsarray *types = @[avmetadataobjecttypeqrcode];        qrcodereaderviewcontroller* _reader = [Qrcodereaderviewcontroller readerwithmetadataobjecttypes:types];        Set the presentation style _reader.modalpresentationstyle = Uimodalpresentationformsheet;        Using delegate methods _reader.delegate = self; Or by using blocks [_reader setcompletionwithblock:^ (NSString *resultasstring) {[Self Dismissviewcontrollera        Nimated: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];}
When installing with cocoapods, there may be errors in compiling, and you need to modify the settings of the pods target: there is another way, I did not look closely. Put it here for reference: http://cameronspickert.com/2014/01/20/remove-the-arm64-architecture-from-cocoapods-targets.html

IOS8 Two-dimensional code scanning-qrcodereaderviewcontroller

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.