IOS。 segue.destinationViewController对象与Controller加载的不同

时间:2013-01-21 20:24:10

标签: ios uinavigationcontroller segue

我正在尝试使用导航控制器在两个ViewControllers之间进行转换,segue.destinationViewController引用的对象是:0x1cd93590(下一个视图),但是当对新视图进行更改时,它具有不同的数字对象:0x1cd4556d0。我的代码是:

- (void)updateCodeProduct:(NSString *)code {
    [session stopRunning];

    AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
    AudioServicesPlaySystemSound(1111);

    // db acces.
    NSString *cadena = @"http://172.20.10.2/consultaProd.php?codigo=";
    cadena = [cadena stringByAppendingString:codigo];
    NSURL *url = [NSURL URLWithString:cadena];
    NSError *error = nil;

    NSString *retorno = [[NSString alloc] initWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&error];
    if (retorno == nil) {
        NSLog(@"Error %@\n%@", url, [error localizedFailureReason]);
        return;
    }

    self.detailProd = nil;
    self.detailProd = [retorno componentsSeparatedByString:@"\n"];

    [self performSegueWithIdentifier:@"DetailSegue" sender:self];    
}

prepareForSegue方法是:

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
NSLog(@"%@", [segue destinationViewController]);

    if ([segue.identifier isEqualToString:@"DetailSegue"]) {
        [segue.destinationViewController updateDetail:detailProd];
    }
}

执行segue,但视图不反映当前信息,因为它是一个不同的对象。

任何帮助将不胜感激:)

0 个答案:

没有答案