I am using TableViewController, which has a table with two sections of static cells. This is built into the view controller. I cannot get didSelectRowAtIndexPath to work when I click on cells. I have already checked all the usual suspects from this question, as well as this one . When I try with a table view inside a viewcontroller with a dynamic table, I can make it work fine. Is there a problem with using a TableViewController with static cells that would not allow didSelectRowAtIndexPath to be used?
Here is what I have in the custom class for the TableViewController:
import UIKit class OptionTableViewController: UITableViewController { @IBOutlet var optionsTable: UITableView! let numberOfRows = [7,2] let cellIdentifier = "OptionCells" override func viewDidLoad() { super.viewDidLoad() self.optionsTable.delegate = self self.optionsTable.dataSource = self } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning()
Update: I tried replacing the tableviewcontroller and the viewcontroller in which it was embedded, but I still cannot run didSelectRowAtIndexPath.
Update 2: Does anyone know if this is possible in Swift 3? I found a working example using Swift 2.2 using tableviewcontroller and static cells here . Maybe there is a bug with Swift 3?
source share