Utku Dalmaz Utku Dalmaz - 1 year ago 31
Swift Question

Segue is not working from static UITableView

I have a TableViewController with static cells

I tried both creating segue from TableViewController and TableView cell (Not at the same time)

However, in both scenario,

was not fired

override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {

I also have embedded collectionviewcontroller

class EventDetail: UITableViewController, UITextFieldDelegate, UICollectionViewDataSource, UICollectionViewDelegate {

What may be causing this?


Check your tableview selection must be single selection, if it is "No selection" then didSelectedRowAtIndex would not get called.

enter image description here

You can download sample code and observe it.

Sample download

Also check

enter image description here

Ideally your cellForRowAtIndex should be like this

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell
    let cell : CustomCell! = tableView.dequeueReusableCellWithIdentifier("ID_CustomCell", forIndexPath: indexPath)  as! CustomCell

    cell.selectionStyle =  UITableViewCellSelectionStyle.None

    cell.lblData.text = "CustomCell....."
    return cell