ZBar删除信息按钮(ios 6)

时间:2013-08-26 17:55:42

标签: ios zbar-sdk zbar

如何从底部屏幕(阅读器屏幕)的工具栏中删除信息按钮。我尝试使用覆盖方法,但它不起作用。希望有人能救我。感谢

-(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];
}

1 个答案:

答案 0 :(得分:0)

我最终创建了新的UIView&将其应用于cameraOverlayView对象ZBarReaderViewController的{​​{1}}属性。

它实际上是从ZBar官方文档中推荐的。

codeReader

[这里是我添加的self.codeReader.showsCameraControls = NO; self.codeReader.showsZBarControls = NO; [self.codeReader setCameraOverlayView:self.viewCancelButtonQRCodeReader]; 的屏幕截图。它的背景颜色为UIView。]

UIView for camera overlay