1, to download zbarsdk.
2. Create your iOS Project.
3. Import ZBARSDK, drag the zbarsdk you downloaded to your project directly, and select the Copy option.
4. Add the following framework
5. Add the following methods to the Appdelegate file as follows:
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions{ // Your code class ]; return YES;}
6. In the ViewController.h file you need to use the scan function, Add the following:
#import <UIKit/UIKit.h>"ZBarSDK.h"@interface Scanviewcontroller: Uiviewcontroller<ZBarReaderViewDelegate>{ *readerview; **readerview; @end
7. In the viewcontroller.m file you need to use the scan function, Add the following:
#import"ScanViewController.h"@interface Scanviewcontroller () @end @implementation scanviewcontroller@synthesize Readerview;- (void) viewdidload{[Super Viewdidload]; //Your codeReaderview.readerdelegate =Self ; [Readerview Setallowspinchzoom:yes]; if(target_iphone_simulator) {Camerasim=[[Zbarcamerasimulator alloc] initwithviewcontroller:self]; Camerasim.readerview=Readerview; }}-(void) Viewdidappear: (BOOL) animated{[Readerview start];}-(void) Viewdiddisappear: (BOOL) animated{[Readerview stop];}-(void) Readerview: (Zbarreaderview *) Readerview didreadsymbols: (Zbarsymbolset *) symbols FromImage: (UIImage *) image{NSString*codedata =[[NSString alloc] init];; for(Zbarsymbol *syminchsymbols) {CodeData=Sym.data; Break; } Uialertview*alert = [[Uialertview alloc] Initwithtitle:@"Scan Results"Message:codedataDelegate: Self Cancelbuttontitle:@"OK"Otherbuttontitles:nil, nil]; [Alert show];}-(void) Imagepickercontroller: (Uiimagepickercontroller *) Picker Didfinishpickingmediawithinfo: (NSDictionary *) info{//Get Barcode Resultsid<nsfastenumeration> results =[Info objectforkey:zbarreadercontrollerresults]; Zbarsymbol*symbol =Nil; for(symbolinchresults) Break; //Get to Barcode//NSString *datanum=symbol.data; //Scan Interface Exit[Picker dismissmodalviewcontrolleranimated:yes];}
Use ZBARSDK for iOS to scan QR codes and barcode functions