Frage

I'm developing a storyboard based app, and trying to get a UITableViewController within a Container view working. It's set up pretty basically, with a container view in my main view, which is linked to my TableViewController with an embed segue (i.e. all done in Interface Builder).

My problem is that I can't select rows within the table view. I've implemented tableView:didSelectRowAtIndexPath:, and when I rewire the table view as a standalone view, it works just fine. I can scroll the table view fine, so presumably the touch events aren't being stolen by some other part of the view. Is there anything special I need to be doing here, or I might be overlooking?

War es hilfreich?

Lösung 2

It turns out that the problem was a gesture recognizer left over from a previous iteration of the prototype. I had disconnected the action, but not the connection to the gestureRecognizer collection for the associated view.

Andere Tipps

Make sure that you are setting both delegate and dataSource on the tableView. Currently it looks like you are setting only delegate.

You can do it inside Interface Builder by dragging reference of tableView delegate to your ViewController (file's owner). Or you can do it programmatically inside your view controller by:

self.tableView.delegate = self;
self.tableView.datasource = self;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top