1

How to I remove the information button from the toolbar at the bottom screen (reader screen).I have tried the using the overlay method but it didn't work. Hope someone would save me. Thanks

-(void)viewDidLoad

{

    [super viewDidLoad];
    // Do any additional setup after loading the view.
    ZBarReaderController *reader = [ZBarReaderController new];
    reader.readerDelegate =self;
    reader.sourceType =UIImagePickerControllerSourceTypeCamera;
    reader.showsCameraControls=YES;
    // Define button title color when disabled (Grey)
    [btnFindMe setTitleColor:[UIColor grayColor] forState:UIControlStateDisabled];
    [self activateScan];

}




-(void) activateScan
{

    ZBarReaderViewController *reader  = [ZBarReaderViewController new];
    reader.readerDelegate = self;
    reader.supportedOrientationsMask = ZBarOrientationMaskAll;
    [reader.scanner setSymbology: 0
                          config: ZBAR_CFG_ENABLE
                              to: 0];
    [reader.scanner setSymbology: ZBAR_QRCODE
                          config: ZBAR_CFG_ENABLE
                              to: 1];
    reader.readerView.zoom = 1;
    reader.showsZBarControls=FALSE;
    UIView *overlay = [[UIView alloc] initWithFrame:CGRectMake(0.0,0.0,320.0,480.0)];
     overlay.backgroundColor = [UIColor clearColor];
     UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0.0,510.0,320.0,54.0)];
     UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc]
                                     initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
                                     target:self                                     action:@selector(closeScanner)];
     toolbar.items = [NSArray arrayWithObjects:cancelButton,nil];

    [overlay addSubview:toolbar];
    reader.cameraOverlayView = overlay;
    [self presentModalViewController: reader  animated: YES];
}
Mick MacCallum
  • 129,200
  • 40
  • 280
  • 281
Billy
  • 111
  • 1
  • 3

1 Answers1

0

I ended up creating new UIView & apply it to cameraOverlayView property of ZBarReaderViewController's object codeReader.

It's actually recommended from ZBar official docs.

self.codeReader.showsCameraControls = NO;
self.codeReader.showsZBarControls = NO;
[self.codeReader setCameraOverlayView:self.viewCancelButtonQRCodeReader];

[Here's the screenshot of UIView that i added. It has background color as clearColor.]

UIView for camera overlay

Akshit Zaveri
  • 4,166
  • 6
  • 30
  • 59