Created
December 1, 2016 15:15
-
-
Save keith-kurak/303f5a4056aeccc2d927f833ccad7c0e to your computer and use it in GitHub Desktop.
Test Objective C snippet
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
//start scanning when the Scan button is pushed down (touch down) | |
- (IBAction)startScanning:(id)sender { | |
if(![self.session isRunning]) | |
{ | |
[self.barcodeScanAreaView.layer addSublayer:_prevLayer]; | |
[_session startRunning]; | |
[self.barcodeScanAreaView bringSubviewToFront:_highlightView]; //isn't necessary at this point because the line gets removed before anyone sees it. Could be useful if there was a delay before shutting down the view and recording the scan | |
} | |
} | |
//stop scanning when the button is pushed up (inside button) (touch up inside) | |
- (IBAction)stopScanning:(id)sender { | |
if([self.session isRunning]) | |
{ | |
[_session stopRunning]; //this makes the camera stop streaming to the screen. | |
[self.prevLayer removeFromSuperlayer]; //this makes the view containing the camera image go blank | |
} | |
} | |
//stop scanning when the button is pushed up (outside button) (touch up outside) | |
- (IBAction)stopScanning_Outside:(id)sender { | |
if([self.session isRunning]) | |
{ | |
[_session stopRunning]; | |
[self.prevLayer removeFromSuperlayer]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment