我有一个父视图控制器和两个容器,如下所示:
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
MyCombinationsViewController *myComb = [storyboard instantiateViewControllerWithIdentifier:@"MyCombinationsViewControllerID"];
myComb.view.frame = self.combinationsContainer.bounds;
[self.combinationsContainer addSubview:myComb.view];
[self addChildViewController:myComb];
[myComb didMoveToParentViewController:self];
StatInfoViewController *stat = [storyboard instantiateViewControllerWithIdentifier:@"StatInfoViewControllerID"];
stat.view.frame = self.statContainer.bounds;
[self.statContainer addSubview:stat.view];
[self addChildViewController:stat];
[stat didMoveToParentViewController:self];
StatInfoViewController
我想在那个效果里面做点什么MyCombinationsViewController
。如何在不重新分配的情况下访问 MyCombinationsViewController 属性?
这样做:
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
MyCombinationsViewController *myComb = [storyboard instantiateViewControllerWithIdentifier:@"MyCombinationsViewControllerID"];
StatInfoViewController
当我尝试执行类似的操作时,内部返回空属性NSLog(@"%@",myComb.something);