I have two classes: DashboardViewController
(having an integer variable 'userid') and LoginViewController
. I instantiate a DashboardViewController
and set the value of userid
from LoginViewController
, but when I print the value of userid
in DashboardViewController
, it prints 0
. Could someone please help me with this?
This is how I instantiate DashboardViewController
from LoginViewController
('serverOutput' is a string containing a single integer value:
DashboardViewController *newView = [[DashboardViewController alloc] init];
[self presentViewController:newView animated:YES completion:nil];
newView.userid = [serverOutput intValue];
I then go to DashboardViewController
and put:
NSLog([NSString stringWithFormat:@"%d",userid]);
and this prints 0 instead of the integer value it should. Any help would be appreciated.