我在A中有两个ViewController我尝试在B V.C中传递一个User对象,但它仍然是nil:
在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];
在断点处,用户对象" selectedUser"不是零并且包含数据。
但是在加载B时这里:
//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;
我的_selectedUser对象是nil,我做错了什么?