Created
April 17, 2012 10:25
-
-
Save taylanpince/2405109 to your computer and use it in GitHub Desktop.
ZBar Integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZBarReaderViewController *controller = [ZBarReaderViewController new]; | |
[controller setReaderDelegate:self]; | |
[controller.scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0]; | |
UIView *overlayView = [[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, self.view.frame.size.width, 80.0)]; | |
UILabel *helpLabel = [[UILabel alloc] initWithFrame:CGRectInset(overlayView.bounds, 15.0, 10.0)]; | |
[helpLabel setFont:[UIFont boldSystemFontOfSize:14.0]]; | |
[helpLabel setTextColor:[UIColor whiteColor]]; | |
[helpLabel setTextAlignment:UITextAlignmentCenter]; | |
[helpLabel setNumberOfLines:0]; | |
[helpLabel setLineBreakMode:UILineBreakModeWordWrap]; | |
[helpLabel setBackgroundColor:[UIColor clearColor]]; | |
[helpLabel setText:NSLocalizedString(@"Align your camera at about 3 to 5 \ | |
inches from a barcode and hold still. \ | |
Scanner will automatically detect it.", nil)]; | |
[overlayView addSubview:helpLabel]; | |
[overlayView setBackgroundColor:[[UIColor blackColor] colorWithAlphaComponent:0.6]]; | |
[controller setCameraOverlayView:overlayView]; | |
[overlayView release]; | |
[helpLabel release]; | |
[self presentModalViewController:controller animated:YES]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment