Вопрос

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?

Это было полезно?

Решение 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.

Другие советы

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;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top