ios - Scanning and capturing barcode with ZBar -
trying use zbar capture barcode. have following code in place @ moment. scanner shows, , appears scan barcode green overlay appears around code. don't know how capture decoded results.
i'm going wrong, thought i'd ask. nothing output console when scanning, don't think didreadsymbols being called @ all.
.h
@interface scannerviewcontroller : uiviewcontroller <zbarreaderdelegate> { } @property (strong, nonatomic) iboutlet uilabel *readerresult; @property (strong, nonatomic) iboutlet uiview *readerview; @property (strong, nonatomic) iboutlet zbarreaderview *zbr;
.m
- (void)viewdidload { [super viewdidload]; // force class load may referenced directly nib [zbarreaderviewcontroller class]; zbarreaderviewcontroller *reader= [zbarreaderviewcontroller new]; reader.readerdelegate = self; zbarimagescanner *scanner = reader.scanner; //reader.cameraoverlayview = self.readerview; [scanner setsymbology: 0 config: zbar_cfg_enable to: 1]; [reader setshowszbarcontrols:no]; [reader.readerview start]; self.zbr = reader.readerview; [self.view addsubview:reader.view]; } - (void) zbr: (zbarreaderview*) view didreadsymbols: (zbarsymbolset*) syms fromimage: (uiimage*) img { nslog(@"scanner used"); //do useful results , display resulttext in resultviewcontroller for(zbarsymbol *sym in syms) { nslog(@"logged"); //return resulttext; break; } }
any advice great. i'm getting confused @ moment. cheers.
when @ documentation zbar, i see delegate method signature is:
- (void) readerview:(zbarreaderview*)readerview didreadsymbols:(zbarsymbolset*)symbols fromimage:(uiimage*)image
which not same thing have above. replace "zbr
" "readerview
" , delegate method should called.
Comments
Post a Comment