Presenting View Modally in ZBar delegate method

2019-09-02 10:22发布

I am developing a QR code reader application using ZBar. I am using XCode 4.2

Here is my code where I am presenting another view modally after scanning the QR code successfully, and it doesn't work:

- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
    // ADD: get the decode results
    NSString *test3=@"test";

    id<NSFastEnumeration> results =
    [info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results){
    theBarcodeString = symbol.data;
    if ([theBarcodeString isEqualToString:test3]){
        nextView *next ;   
        next= [[nextView alloc] initWithNibName:nil bundle:nil];
        [self presentModalViewController:next animated:YES];
    }
    }
    // ADD: dismiss the controller (NB dismiss from the *reader*!)

    [reader dismissModalViewControllerAnimated: YES];   
}

0条回答
登录 后发表回答