QR码集成

时间:2012-12-12 08:11:41

标签: iphone objective-c zbar-sdk

在我的应用上集成ZBar框架扫描QRCodeRead后,我遇到了一些问题。我的客户想要的是,QRCode扫描仪将处于固定的框架中,不能是PresentModalView。所以我为固定帧QRCode扫描器编写代码并在reader.view上添加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];
}

请帮助我并提供解决方案。谢谢。

0 个答案:

没有答案