Note that there are some explanatory texts on larger screens.

plurals
  1. POSubclass of UITableViewController will not fire didSelectRowAtIndexPath when it is contained in a subview, how can I fix this?
    primarykey
    data
    text
    <p>I have a view controller embeded in another view using 'addSubView' that is not catching events, how can I make sure it does? </p> <p>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:</p> <pre><code>//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); </code></pre> <p>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. </p> <p>I know it's not firing thanks to good ol' NSLog():</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"Please kind sirs help a poor string appear in the console."); } </code></pre> <p><strong>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.</strong></p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload