HHBarCodeViewController 1.0.1

HHBarCodeViewController 1.0.1

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Harlan Haskins.



HHBarCodeViewController is a quick modal Bar Code reader using the iOS 7 native bar code scanning APIs.

This was originally for me to use because the only implementations I could find were code snippets on blog posts, so I consolidated that code and made it into a handy modal view controller that can be easily presented and has fancy delegate callbacks.

Woohoo.

Installation

Installation is easiest through CocoaPods. Just add this line to your Podfile pod 'HHBarCodeViewController'

Usage

Usage is pretty simple. Just instantiate an HHBarCodeViewController using [HHBarCodeViewController new] and present it or push it. Upon recognizing a bar code, the delegate method barCodeViewController:didDetectBarCode: or the block detectedBarCodeBlock() will be called.

I'd highly recommend if you use the returned bar code that you do it in a completion after dismissing the ViewController. This will prevent repeated actions since HHBarCodeViewController calls that delegate method multiple times in its lifetime.

Like this:

- (void) barCodeViewController:(UIViewController *)barCodeViewController didDetectBarCode:(NSString *)barCode {
    [self dismissViewControllerAnimated:YES completion:^{
        dataTextView.text = barCode;
    }];
}

Author

Harlan Haskins (@harlanhaskins)

License

HHBarCodeViewController is available under the MIT license, a copy of this is in the file called LICENSE.