Tuesday, 16 October 2012

Zbar reader with no controls & without the bottom bar. + iphone

reader = [ZBarReaderViewController new];
           
            UIView * infoButton = [[[[[reader.view.subviews objectAtIndex:1] subviews] objectAtIndex:0] subviews] objectAtIndex:2];
            [infoButton setHidden:YES];
            reader.readerDelegate = self; reader.wantsFullScreenLayout=YES;
            reader.hidesBottomBarWhenPushed = YES;
            reader.showsZBarControls = NO;
           
            if (fromInterfaceOrientation==UIInterfaceOrientationLandscapeLeft) {
                fromInterfaceOrientation=UIInterfaceOrientationLandscapeRight;
            }
            else{
                fromInterfaceOrientation=UIInterfaceOrientationLandscapeLeft;
            }
            reader.supportedOrientationsMask = ZBarOrientationMask(fromInterfaceOrientation);
            ZBarImageScanner *scanner = reader.scanner;
            //TODO: (optional) additional reader configuration here
            //EXAMPLE: disable rarely used I2/5 to improve performance
            [scanner setSymbology: ZBAR_I25
                           config: ZBAR_CFG_ENABLE
                               to: 0];
            [scanCameraView addSubview:reader.view];
         
            reader.view.frame=CGRectMake(0, 0, scanCameraView.frame.size.width, scanCameraView.frame.size.height);
            reader.readerView.frame=reader.view.frame;
            [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];

No comments:

Post a Comment