1

在我的应用程序上集成ZBar扫描框架后,我遇到了一些问题QRCodeRead。我的客户想要,QRCode Scanner 将在一个固定的框架中,并且不能是PresentModalView. 所以我为固定框架 QRCode Scanner 编写代码并添加了reader.viewon self.view,但它不能作为presentModalViewController:reader. 我不知道出了什么问题。我无法解决这个问题。我在下面提供了我的代码,很抱歉我的英语不好。

此代码正在运行...

- (IBAction) scanButtonTapped
{
    ZBarReaderViewController *reader = [ZBarReaderViewController new];
    reader.readerDelegate = self;
    reader.supportedOrientationsMask = ZBarOrientationMaskAll;

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

    // present and release the controller
    [self presentModalViewController:reader animated:YES];
    [reader release];
}

但是此代码不起作用...

- (IBAction) scanButtonTapped
{
    // Create new reader
    ZBarReaderViewController *reader = [ZBarReaderViewController new];
    reader.readerDelegate = self;
    [reader.scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0];
    reader.showsCameraControls = NO;
    reader.showsZBarControls = NO;
    [reader setWantsFullScreenLayout:NO];
    reader.showsHelpOnFail = NO;
    reader.showsZBarControls = NO;
    [reader.view setFrame:CGRectMake(20, 134, 280, 202)];

    [self.view addSubview:reader.view];
    [reader release];
}

请帮助我并提供解决方案。在此先感谢。

4

0 回答 0