0
訪問容器視圖控制器我有一個父視圖控制器和兩個容器中這樣說:從另一個容器視圖控制器
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);
使用NSNotificationCenter訪問myCombinationsViewController如果兩個集裝箱都沒有關係。 – Tirth