trouble passing variable
HI have a little problem, I want to pass a simple variable between 2 viewcontrollers, I try in this way but I get a null variable.
Controller1.m
SecondaVista *secondaVista = [[SecondaVista alloc] init] ;
[self.navigationController pushViewController:secondaVista animated:YES];
secondaVista.titolo = @"Ciao";
Controller2.h
NSString *titolo;
@propert开发者_如何学JAVAy (nonatomic,retain) NSString *titolo;
Controller2.m
NSLog(@"%@",self.titolo);
where is the mistake?
try setting the variable before pushing the view.
SecondaVista *secondaVista = [[SecondaVista alloc] init] ;
secondaVista.titolo = @"Ciao";
[self.navigationController pushViewController:secondaVista animated:YES];
Where are you logging the variable? I mean in viewDidLoad or viewWillAppear where?
精彩评论