For UITextView set textView.userInteractionEnabled = false , and if you have a UITextField , set textField.userInteractionEnabled = false .
If you want textView or textField to be editable after the cell with it is clicked, do something like this:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { tableView.deselectRowAtIndexPath(indexPath, animated: true) let cell = tableView.cellForRowAtIndexPath(indexPath)! as UITableViewCell // find first textField inside this cell and select it for case let textField as UITextField in cell.subviews { textField.userInteractionEnabled = true textField.becomeFirstResponder() return } // find first textView inside this cell and select it for case let textView as UITextView in cell.subviews { textView.userInteractionEnabled = true textView.becomeFirstResponder() return } }
Then make sure you turn off user interaction after editing is completed:
func textFieldDidEndEditing(textField: UITextField) { textField.userInteractionEnabled = false
Remember to set UITextFieldDelegate and / or UITextViewDelegate
Hope this helped someone :)
budidino
source share