Hi, everyone, i have no idea why this doesn't work hopefully someone here can help me out. Here's what i'm trying to do:
I've got two ViewControllers, lets call them secondViewController and firstViewController. The firstViewController is shown when the application starts and it pushes the secondViewController.
Inside the secondViewController i defined a property.
Now i want to change this property in the firstViewController and then push the secondViewController but for some reason as soon as the secondViewController is pushed my property is reseted to zero.... why is this happening? heres my code:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
secondViewController.test = 2;
[self.navigationController pushViewController:secondViewController animated:YES];
}
The test property in this example is just a simple NSInteger. Now as soon the secondViewController is pushed the "test" value is no longer two it's zero..... Why????
here's the header file of my secondViewController: #import
@interface secondViewController : UIViewController {
NSInteger test;
}
@property NSInteger test;
@end
here's the .m file:
- (void) viewDidLoad{
NSLog(@"%i", self.test):
}