Segue not triggering with custom Table Cell

I'm struggling with segueing from one View Controller to another using a custom Table View Cell. The issue that occurs is that sometimes segues aren't triggered just by tapping the cell, but I have to tap twice.


For better understanding I've put a video on youtube.

https://youtu.be/cJI6jRc5vuA


As you can see in the video each time I tap a cell, I print out "Selected". However, some times when I tap the cell, the log prints out "Selected" but the segue isn't triggered before I tap anywhere in the app again.


Here's the code I use in this video. The code isn't that interesting though, since most is done in the storyboard.


First View Controller

    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
   
        return 100.0
    }

    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
   
        return 2
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
   
        var cell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath: indexPath) as! CustomCell
   
        cell.firstLabel.text = "I'm a Custom Cell"
   
        return cell
    }

        func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        println("Selected")
    }


Custom Table View Cell

class CustomCell: UITableViewCell {
  
    @IBOutlet var firstLabel: UILabel!
}


I'm using Xcode 6.4 and I've tested the app on several iOS devices with the same result.


Any help would be very much appreciated.
Thank you,
HE.

Accepted Reply

For future reference: Okay, I've found a couple of useful work-arounds for this problem, as well as what causes this problem, but not why it happens. It seems to only occur when you've selected either a custom or basic Table View Cell Style. This can be done in the utilities-area when the Table View Cell is selected (Image).


Setting the selection-value to anything else than "None" seem to work for some people as well (Image).


What worked for me was deselecting the cell right after I selected it. That can be accomplished with by adding this code (Thanks Scott D. Strader @ Stack Overflow):

    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
     
        tableView.deselectRowAtIndexPath(indexPath, animated: false)
    }

Stack Overflow thread...

Replies

For future reference: Okay, I've found a couple of useful work-arounds for this problem, as well as what causes this problem, but not why it happens. It seems to only occur when you've selected either a custom or basic Table View Cell Style. This can be done in the utilities-area when the Table View Cell is selected (Image).


Setting the selection-value to anything else than "None" seem to work for some people as well (Image).


What worked for me was deselecting the cell right after I selected it. That can be accomplished with by adding this code (Thanks Scott D. Strader @ Stack Overflow):

    func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
     
        tableView.deselectRowAtIndexPath(indexPath, animated: false)
    }

Stack Overflow thread...