1. PrefaceCurrently in the mainstream market app, QR code/Barcode integration is mainly divided into two forms to integrate: a. One is to call the phone camera and open the system camera full screen to shoot B. One is to customize the frame of the camera view, control and add the relevant code guide to me today I'm going to use ZBARSDK to make appeals. Two main ways of integration, sharing learning with everyone2. First step import zbarsdkYou can download the ZBARSDK from GitHub, import the project, and import the relevant ios.framework3. Integrated scan QR code/Barcode3.1. Call the phone camera and open the system camera full screen to shoot
Implementation: 1. A button "Sweep Me"--2. Click to open the System camera--3. Go to full screen shooting, take the QR code--4. Identify successful auto-off camera
3.1.1. Import #import "ZBarSDK.h" and implement the relevant protocol
Call system camera full screen shot, using the protocol is <ZBARREADERDELEGATE>, custom camera window using <ZBarReaderViewDelegate>
3.1.2. Implement details in the click Method of the button "Sweep Me"
Initialize the camera controller zbarreaderviewcontroller *reader = [Zbarreaderviewcontroller new]; Set proxy reader.readerdelegate = self; Basic adaptation reader.supportedorientationsmask = Zbarorientationmaskall; QR Code/Barcode Recognition Settings Zbarimagescanner *scanner = Reader.scanner; [Scanner setsymbology:zbar_i25 config:zbar_cfg_enable to:0]; Eject system camera, full screen shooting [self presentmodalviewcontroller:reader animated:yes];
3.1.3. Implementing Proxy Methods
3.2. Customize the frame of the camera view, control and add the relevant code guide3.2.1. Import #import "ZBarSDK.h" and implement the relevant protocol Call system camera full screen shot, using the protocol is <ZBARREADERDELEGATE>, custom camera window using <ZBarReaderViewDelegate>3.2.2. Implement details in the click Method of the button "Sweep Me"
Initialize Camera window zbarreaderview *readview = [Zbarreaderview new]; Custom size Readview.frame = CGRectMake (+, +, +); Custom Add related instructions ..... Play the imaginations of their respective apps/ /omit to beautify the 10000 lines of code here ..... ......... ........... Good to get to the point--and then set the agent readview.readerdelegate = self; Add its camera capture view to the view you want to display [Self.viewaddSubview:readview]; QR Code/Barcode Recognition Settings Zbarimagescanner *scanner = Readview.scanner; [Scanner setsymbology:zbar_i25 config:zbar_cfg_enable to:0]; Start, must start after the phone camera shot the instant image dish can be displayed on Readview [Readview start];
3.2.3. Implementing Proxy Methods
Clear Saup
Source: http://www.cnblogs.com/qingche/
This article is copyright to the author and the blog Park is shared, welcome reprint, but must retain this paragraph statement, and in the article page obvious location to give the original text connection.
ios-detailed how to use ZBARSDK Integrated scan QR code/Barcode, point me!