The controllers contained in a container view can be accessed by self.childViewControllers from the parent controller. If you only have one, then it will be at self.childViewControllers[0].
Note: regarding RD's excellent technique explained in the comment below; here's a typical example, tested and working: this simply goes in the VC of the overall scene. Just click on the segue itself (ie, the small symbol in the middle of the connecting arrow) to set the text identifier.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"containerLogin"])
self.vcLogin = (LoginVC *)segue.destinationViewController;
if ([segue.identifier isEqualToString:@"containerStartNew"])
self.vcStartNew = (StartNewVC *)segue.destinationViewController;
}
Here's just how to do it in Swift: (you have to be careful with the unwrappers)
override func prepareForSegue(segue:(UIStoryboardSegue!), sender:AnyObject!)
{
if (segue.identifier == "feedContainer")
{
feed = segue!.destinationViewController as! Feed
feed.someFunction()
}
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…