I currently have three view controllers: ViewController1 ViewController2 and ViewController3. I'm trying to pass data between ViewController1 and ViewController2 and between ViewController2 and ViewController3.
For example, to pass data user holds from ViewController1 to ViewController2 I use:
ViewController2 *vc2 = [[ViewController2 alloc]init];
vc2.user = _user;
[self.navigationController pushViewController:vc2 animated:YES];
but if I try to pass user from ViewController2 and ViewController3, I can't use the above method...I just get a black view controller appear on screen.
Instead, I tried this and it works:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
ViewController3 *vc3 = [storyboard instantiateViewControllerWithIdentifier:@"vc3Storyboard"];
vc3.user = _user;
[self.navigationController pushViewController:vc3 animated:YES];
Why can't i use the same method i used for vc1 -> vc2?
ViewController3 *vc3 = [[ViewController3 alloc]init];
vc3.user = _user;
[self.navigationController pushViewController:vc3 animated:YES];
