1

I am having trouble dismissing a modal view controller containing a UIImagePickerController (ZBarScannerController). For some reason, after dismissing the controller after scanning a bar code with the iphone camera, the view controller always leaves a rectangle of stale graphical data over the same area as the ZBarScannerController's tool bar. The corrupt data is always a portion of whatever image the camera was seeing at the moment.

An image of the problem (corrupt area in red rectangle): screenshot

It is impossible to remove that rectangle of corrupt screen data except by backgrounding / killing the app. Also, if I specify NO when I dismiss the modal picker, the OS will remove the view controller while still displaying the controller on screen, causing crashes if I interact with any controls on the modal view. How can I go about fixing the problem?

Code for dismissing the controller:

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

Code for making the controller:

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

}
futureelite7
  • 11,462
  • 10
  • 53
  • 87
  • We've seen something like this as well; thought it might be associated with another picker problem: http://stackoverflow.com/questions/3088874/didfinishpickingmediawithinfo-return-nil-photo/4192109 – Oscar Mar 18 '11 at 12:51

0 Answers0