1

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

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

1 回答 1

0

我最终创建了新的UIView并将其应用于's object 的cameraOverlayView属性。ZBarReaderViewControllercodeReader

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

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

[这UIView是我添加的屏幕截图。它的背景颜色为clearColor。]

用于相机覆盖的 UIView

于 2014-03-07T15:29:17.800 回答