"IOS" Integrated zxing (QR code scan)

Source: Internet
Author: User

Now that the zxing has reached version 2.2, there have been some problems with the previous integration approach. Let me make a little correction.
Previous versions of the integration method, refer to: http://blog.devtang.com/blog/2012/12/23/use-zxing-library/
After doing the same as before, then it is appropriate to modify the current version as follows
1. Add Sentestingkit frame set to optional
2. Delete the tests under the catalogue Iphone/zxingwidget
3. Keep the bigint file for directory Cpp/core/src
Last reminder: You should select the User Header search Paths option to add a Find path when you set the Find path
A little insurance. Select Always Search User Paths yes so that's it.

There is to support ios4.3 words to set up a c++standard Library for libstdc++ so you can support 4.3 of the version

Online generation of two-dimensional Code of the website: http://cli.im/"Expand: Specific Area Scan"
Two-dimensional code scanning process:
The program has a callback method to get the screen picture and then parse it. The scan will constantly get screen images to parse.

Custom Scan Area Ideas:
As long as we take the entire screen image captured in the callback method to intercept an area, we can achieve the specific area scanning function

1 //callback Method2- (void) Captureoutput: (Avcaptureoutput *) captureoutput Didoutputsamplebuffer: (cmsamplebufferref) SampleBuffer Fromconnection: (Avcaptureconnection *) Connection3 {4   //The first step is to turn Samplebuffer into UIImage5UIImage *image =[self imagefromsamplebuffer:samplebuffer];6     //Step Two, identify the image with decoder7 [self decodeimage:image];8 }9 Ten #pragmaMark-Capture Pictures One  A- (void) Cutmapview: (UIView *) TheView -  - { the  - //************** get Picture ******************* -  -CGRect rect = theview.frame;//Capture Image size +  -   +  A //start drawing, Parameters: Picture size at  - Uigraphicsbeginimagecontext (rect.size); -  - //layer into context -  - [Theview.layer Renderincontext:uigraphicsgetcurrentcontext ()]; in  - //get the picture from the context to  +UIImage *image =Uigraphicsgetimagefromcurrentimagecontext (); -  the //End *  $ Uigraphicsendimagecontext ();Panax Notoginseng  -   the  +   A  the //************** Save Picture ******************* +  -Nsarray *paths =nssearchpathfordirectoriesindomains (Nsdocumentdirectory,nsuserdomainmask, YES); $  $NSString *filepath = [[Paths Objectatindex:0] Stringbyappendingpathcomponent:[nsstringstringwithformat:@"%@.png",@"Jietu"]];//Save the name of the file -  -NSLog (@"FilePath =%@", FilePath); the  - //Uiimagepngrepresentation method to convert an image object to a NSData objectWuyi  the //write in File -  WuBOOL result =[Uiimagepngrepresentation (image) Writetofile:filepath Atomically:yes]; -  AboutNSLog (@"result =%d", result); $  -   -  -   A  + //*************** intercept small Figure ****************** the  -CGRect rect1 = CGRectMake ( -,0, the, the);//Create a rectangle box $  the //to intercept a picture the  theUIImage * Image2 =[UIImage imagewithcgimage:cgimagecreatewithimageinrect ([Image cgimage], rect1)]; the  -NSString *filepath2 = [[Paths Objectatindex:0] Stringbyappendingpathcomponent:[nsstringstringwithformat:@"%@.png",@"JIETU2"]];//Save the name of the file in  theNSLog (@"FilePath =%@", FilePath); the  AboutBOOL RESULT2 =[Uiimagepngrepresentation (Image2) writetofile:filepath2 Atomically:yes]; the  theNSLog (@"result2 =%d", RESULT2); the  +   -  the //Deposit AlbumBayi  the //Uiimagewritetosavedphotosalbum (viewimage, nil, nil, nil); the  - } -  the  the //capturing a specific area of a picture the /** the * Capture part of a picture from a picture by a specified position size - * UIImage Image original picture the * CGRect rect the area to intercept the */ the-(UIImage *) Imagefromimage: (UIImage *) Image inrect: (cgrect) rect {94Cgimageref Sourceimageref =[Image Cgimage];  theCgimageref Newimageref =Cgimagecreatewithimageinrect (Sourceimageref, rect);  theUIImage *newimage =[UIImage Imagewithcgimage:newimageref];  the     returnNewImage; 98}

"IOS" Integrated zxing (QR code scan)

Related Article

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.