First you need to get the existing instance of GameViewController
that is currently on display. How you do that from CharacterSelectViewController
depends on how they are related to each other and you may want to set up a delegate relationship / navigate the view controller stack to find the correct instance.
Once you have the instance you just access the property:
gameViewController.character.image = ...;
In any case, a delegate type relationship is generally better than navigating the view controller hierarchy. This could be as simple direct relationship or a generalised relationship using an @protocol
.
If GameViewController
presented CharacterSelectViewController
as a modal, then you could use
GameViewController *gameViewController = (GameViewController *)self.presentingViewController;
If GameViewController
pushed CharacterSelectViewController
into its navigation controller, then you could use:
NSArray *viewControllers = self.navigationController.viewControllers;
GameViewController *gameViewController = (GameViewController *) viewControllers[viewControllers.count - 2];