Created
July 16, 2012 18:30
-
-
Save dbaldwin/3124186 to your computer and use it in GitHub Desktop.
Display barcode scanning rectangle area in overlay with RedLaser SDK
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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Create rectangle layer and add it to view | |
rectLayer = [CAShapeLayer layer]; | |
rectLayer.fillColor = [[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.2] CGColor]; | |
rectLayer.strokeColor = [[UIColor whiteColor] CGColor]; | |
rectLayer.lineWidth = 3; | |
[self.view.layer addSublayer:rectLayer]; | |
} | |
- (void) viewWillAppear:(BOOL)animated | |
{ | |
// Draw and display rectangle | |
CGMutablePathRef path = CGPathCreateMutable(); | |
CGRect activeRegionRect = CGRectMake(0, 100, 320, 250); | |
CGPathAddRect(path, NULL, activeRegionRect); | |
[rectLayer setPath: path]; | |
CGPathRelease(path); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment