So, I've added a UITableViewController and UITableViewCell into a UIViewController and while the cellForRowAtIndexPath delegate method works, didSelectRowAtIndexPath does not. Does anyone have any ideas?
EDIT 2: The delegate for the
UITableViewis set to theUIViewController.EDIT 3: I found the answer to my issue on another Stack question here. Basically I had a
UITap...on my[self view]that was blocking thedidSelectRow.... I have no idea why the tap blocks the delegate method and I also have no idea how to get both the tap and the table working together simultaneously.EDIT: The part that bugs me is that I've gotten this exact setup working on an earlier app. So that means I've missed a step somewhere along the way. The thing is, I've combed over all the steps and have compared previous app vs current app and I really have no idea what I missed.
I've added logging to both delegate methods and while one outputs, the other does not.
ViewController.h
#import "...TableViewCell.h" ... UITableViewDataSource, UITableViewDelegate ... ViewController.m
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"cellForRowAtIndexPath"); ... return Cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSLog(@"didSelectRowAtIndexPath"); } ...TableViewCell.h (contents not important)
...TableViewCell.m (contents not important)
cellForRow...method is called we know the table'sdataSourceis set. Did you also set the table'sdelegateproperty? Without setting that thedidSelectRow...method won't be called.UITableViewdelegate property is set to theUIViewController. *Edit: I accidentally saidUITableViewControllerbut I meant to sayUIViewController.- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath.