在委托方法Zbar中不执行Segue

时间:2012-04-04 21:12:42

标签: objective-c ios5

我尝试在捕获QR数据后在Zbar委托方法中执行segue,但是我没有成功我认为有一些与委托方法和segue调用有关的东西。我的想法是执行segue到另一个视图并显示QR扫描结果,我使用segue方法并传递给descuentoController的QR值:

- (void) imagePickerController: (UIImagePickerController*) reader
 didFinishPickingMediaWithInfo: (NSDictionary*) info
{
    // ADD: get the decode results
    id<NSFastEnumeration> results =
    [info objectForKey: ZBarReaderControllerResults];
    ZBarSymbol *symbol = nil;
    for(symbol in results)
        // EXAMPLE: just grab the first barcode
        break;

    // EXAMPLE: do something useful with the barcode data

    self.encodedQR = [encriptationData Midesencriptacion:symbol.data llave:@"RR4$t%%"];

    resultText.text = [encriptationData Midesencriptacion:symbol.data llave:@"RR4$t%%"];;

    // EXAMPLE: do something useful with the barcode image
    resultImage.image =
    [info objectForKey: UIImagePickerControllerOriginalImage];

    NSLog(@"Valor QR %@", resultText.text);

    // ADD: dismiss the controller (NB dismiss from the *reader*!)
    [reader dismissModalViewControllerAnimated: YES];

    [self segue];



}

-(void) segue{
    [self performSegueWithIdentifier:@"descuentoSegue" sender:self];

}


-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

    if ([[segue identifier] isEqualToString:@"descuentoSegue"]) 
    {

       descuentoController *vc = ( descuentoController *)[segue destinationViewController];

        vc.encodedQR = self.encodedQR;

    } 
}

由于

0 个答案:

没有答案