Connect ZXing to a button in xcode

I am new to programming, so this question, I'm sure, is extremely simple (bear with me!)

I just installed zxing in my current xcode 4.5 project. It took me a while to get through the mistakes, but I finally understood.

I created a button called "scan" where I need to call zxing. How can i do this?

I tried to browse the files that I implemented in my source files, but cannot figure out which classes and methods to use.

And yes, I tried a Google search on this extremely basic concept, but found nothing :(

+8
ios iphone xcode button zxing
source share
1 answer

Here is the code you need to add to the scan button action.

- (IBAction)scanPressed:(id)sender { ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO]; NSMutableSet *readers = [[NSMutableSet alloc ] init]; <#if ZXQR> QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init]; [readers addObject:qrcodeReader]; <#endif> <#if ZXAZ> AztecReader *aztecReader = [[AztecReader alloc] init]; [readers addObject:aztecReader]; <#endif> widController.readers = readers; [self presentModalViewController:widController animated:YES]; } 

remove the "<>" before using this code in your application.

+3
source share

All Articles