Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't select the tableView Cell because of textView

I have got a TableView and each cell is covered by a Text View. I think that because of this reason I can't select any cell.

Whenever I try to print it I don't get anything:

func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
        var i = Int()
        i = indexPath.row
        print("i=\(i)")
    }

**Its print and not println because of Swift 2.0.

like image 574
Eliko Avatar asked Nov 07 '25 09:11

Eliko


1 Answers

Please ensure following:

  1. You are correctly setting your view controller as delegate of the table view.

  2. Your touches are intercepted by text view and are not reaching underneath cell. To fix this set userInteractionEnabled to false in cellForRowAtIndexPath: and set it back to true in didSelectRowAtIndexPath:.

like image 117
Abhinav Avatar answered Nov 10 '25 01:11

Abhinav