I have a view controller embeded in another view using 'addSubView' that is not catching events, how can I make sure it does?
background: I'm attempting to nest views in order to break up a storyboard that is to be shared by multiple devs. To accomplish this with minimal duplication of functionality I/we have created a mainStoryboard which contains a tab controller and 4 tabs, each tab contains a subview that loads a UIView (contained in another storyboard) into itself. These views are added like so:
//Add sub view
UIStoryboard *board = [UIStoryboard storyboardWithName:@"MessagesStory" bundle:nil];
UIViewController *boardController = [board instantiateInitialViewController];
[self.view addSubview:boardController.view];
boardController.view.frame = CGRectMake(0, 0, 320, 480);
The initial view controller that is loaded is a UITableView subclass, the whole thing works great for rendering the table and it's contents to the screen and I can interact with the table and select rows, however the event listener on the the views controller 'didSelectRowAtIndexPath' fails to fire.
I know it's not firing thanks to good ol' NSLog():
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Please kind sirs help a poor string appear in the console.");
}
I know it is related to the subview because if I load the subview on it's own as the main view the event listener functions properly.
Any help is appreciated as this is taking longer than expected and I may be pulled to another project before I can finish implementing this.