UITextView in custom UITableViewCell not responding to didSelectRowAtIndexPath

I have a UITextView in my custom UITableViewCell, and the problem is that when I click on it it will not respond to didSelectRowAtIndexPath events or even swipes. How can i fix this? This UITextView is not editable. The reason I use this on UITextField is because I want to easily detect links.

+6
source share
5 answers

I understand this is an old question, but I recently had the same issue. The fix in my case was to simply disable the "User Interaction Enabled" for the UITextView.

+8
source

you need to forward sensory messages from UITableView to UITextView

UITextView inside UITableView

+2
source

The first idea that came to mind ...

In cellForRow, set the text field tag as indexpath.row

Embed - (void)textViewDidBeginEditing:(UITextView *)textView

Based on this textView.tag, call selectrow

  [self.tableView selectRowAtIndexPath:[NSIndexPath indexPathForRow:textView.tag inSection:<#(NSUInteger)#>] animated:<#(BOOL)#> scrollPosition:<#(UITableViewScrollPosition)#>] 
0
source

I do not know if this is what you are looking for. But in my case, I had a custom cell with UIImage and UITextView, and only when I clicked on UIImageView did I get the didSelectRowAtIndexPath recognizer. Make sure UITextView are user interventions that cannot handle this problem.

0
source

Check if your TableView property is set to NO

Wrong: tableView.allowsSelection = false

DidSelect Wont will be called Must have: tableView.allowsSelection = true

Also Check Your Nib

-1
source

Source: https://habr.com/ru/post/888593/


All Articles