解雇模态UIImagePickerController子类后屏幕损坏

时间:2011-02-24 07:55:29

标签: iphone cocoa-touch camera uiimagepickercontroller

我无法解雇包含UIImagePickerController(ZBarScannerController)的模态视图控制器。出于某种原因,在用iphone相机扫描条形码后解除控制器后,视图控制器总是在与ZBarScannerController工具栏相同的区域留下一个陈旧的图形数据矩形。腐败数据始终是相机目前看到的任何图像的一部分。

问题的图像(红色矩形中的损坏区域): screenshot

除非通过后台处理/查杀应用程序,否则无法删除该矩形的损坏的屏幕数据。此外,如果我在解除模态选择器时指定NO,操作系统将移除视图控制器,同时仍然在屏幕上显示控制器,如果我与模态视图上的任何控件进行交互,则会导致崩溃。我该如何解决这个问题?

解雇管制员的代码:

 - (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{

id<NSFastEnumeration> results =
[info objectForKey:ZBarReaderControllerResults];

for (ZBarSymbol *oSymbol in results) {
    //process result

    //Ensure that QR code is decoded
    zbar_symbol_type_t type = oSymbol.type;

    if (type == ZBAR_QRCODE) {
        //Get Barcode Data  
        NSString *dataStr = oSymbol.data;

        [self processCommand:dataStr];

    }
}

//[reader dismissModalViewControllerAnimated:NO];
[[m_oReaderController parentViewController] dismissModalViewControllerAnimated:YES];
}

制作控制器的代码:

    - (void)onQRCameraActivate:(id)sender {

    IPOProofAppDelegate *oAppDelegate = (IPOProofAppDelegate *) [[UIApplication sharedApplication] delegate];

    if (m_oReaderController == nil) {
        m_oReaderController = [[ZBarReaderViewController alloc] init];
        m_oReaderController.readerDelegate = self;
        ZBarImageScanner *oScanner = m_oReaderController.scanner;

        [oScanner setSymbology:0 config:ZBAR_CFG_ENABLE to:0];
        [oScanner setSymbology:ZBAR_QRCODE config:ZBAR_CFG_ENABLE to:1];
    }

    [self.navigationController presentModalViewController:m_oReaderController animated:YES];

}

0 个答案:

没有答案