passing data, still nil in the other ViewController

80 Views Asked by At

I have two ViewController in A I try to pass a User object in the B V.C but it is still nil :

IN A :

User * user = (self.users)[indexPath.row];


UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

CVUserDetailsViewController *userVC = (CVUserDetailsViewController *)[sb instantiateViewControllerWithIdentifier:@"CVUserViewController"];

userVC.selectedUser = [[User alloc] init];
userVC.selectedUser = user;



-> breakpoint [self.navigationController pushViewController:userVC animated:YES];

At the breakpoint, the user object "selectedUser" is not nil and contains data.

But here when B is loaded :

//Instanciate a new header profile from CVUserHeaderView
    _header = [[CVUserHeaderView alloc] initWithFrame:CGRectMake(0, 63, self.view.frame.size.width, 160)];
    _header.backgroundColor = [UIColor whiteColor];

//Add the attributes
_header.trigram = _selectedUser.trigram;
_header.title_job = _selectedUser.title_job;
_header.main_skills = @"IOS, Android";
  --->breakpoint 2  _header.mission_state = _selectedUser.mission_state;

My _selectedUser object is nil, what i am doing wrong ?

0

There are 0 best solutions below