Latest 1.0.1
License MIT
Platforms ios , requires ARC

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 and blocks.



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


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;


Harlan Haskins (@harlanhaskins)


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

Latest podspec

    "name": "HHBarCodeViewController",
    "version": "1.0.1",
    "summary": "HHBarCodeViewController is a quick modal Bar Code reader using the iOS 7 native bar code scanning APIs.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Harlan Haskins": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.1"
    "social_media_url": "",
    "requires_arc": true,
    "platforms": {
        "ios": null
    "source_files": "HHBarCodeViewController/*.{h,m}"

Pin It on Pinterest

Share This