Menu

Overlay Issue On New iPad

iPhone App
Leon Liang
2012-04-11
2013-02-02
  • Leon Liang

    Leon Liang - 2012-04-11

    Hello,

    I have been stuck on this problem for a while now. I am developing an app on the new iPad that uses Zbar and I would like to add a custom overlay to the ZBarReaderViewController. But it does not seem to show up no matter what i try. I have followed the tutorial at http://zbar.sourceforge.net/iphone/sdkdoc/tutorial.html.

    The following is a code snippet:

    - (IBAction)scanButtonTapped:(id)sender
    {
        ZBarReaderViewController *reader = [ZBarReaderViewController new];
        reader.readerDelegate = self;
        reader.supportedOrientationsMask = ZBarOrientationMaskAll;
        
        // Add Custom Overlay
        UIView *customOverlay = [[UIView alloc] initWithFrame:self.view.bounds];
        customOverlay.backgroundColor = [UIColor clearColor];
        customOverlay.opaque = NO;
        
        UIImageView *overlay = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Scanner_Overlay.png"]];
        [customOverlay addSubview:overlay];
        reader.cameraOverlayView = customOverlay;
        
        ZBarImageScanner *scanner = reader.scanner;
        
        [scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0];
        
        [self presentModalViewController:reader animated:YES];
    }
    

    I am not sure what could be the problem. If anyone has any idea at all, please feel free to share it with me. Any help would be well appreciated.

    Thanks!

     
  • myr0

    myr0 - 2012-09-09

    Hi!

    This is maybe too late, but hopefully help others:

    You have to modify ZBarReaderController.h like this:

    /*
    ZBarOrientationMask(UIInterfaceOrientationPortrait) | \
    ZBarOrientationMask(UIInterfaceOrientationPortraitUpsideDown) | \
    */
    // orientation set support
    #define ZBarOrientationMask(orient) (1 << orient)
    #define ZBarOrientationMaskAll \
        (ZBarOrientationMask(UIInterfaceOrientationLandscapeLeft) | \
         ZBarOrientationMask(UIInterfaceOrientationLandscapeRight))

    Greetings!

     
  • myr0

    myr0 - 2012-09-09

    erm… okay, wrong anser, but … erm… sorry for that ;D

    BUT:

            if(reader == nil) {
                reader = ;
                reader.readerDelegate = self;
                reader.showsZBarControls = FALSE;
                reader.tracksSymbols = FALSE;
                reader.supportedOrientationsMask = ZBarOrientationMaskAll;

                if(customView == nil) {
                    customView = ;
                    customView.delegate = self;
                }
                reader.tracksSymbols = 1;
                reader.cameraOverlayView = customView.view;
            }
           
           
            UIApplication *thisApp = ;
            thisApp.idleTimerDisabled = TRUE;
           
            NSNumber *flashModeBool = ;
            reader.cameraFlashMode = ;
            NSLog(@"flashModeBool = %@",flashModeBool);
            ;

    works fine for me ;)

     

Log in to post a comment.