aherlambang
aherlambang

Reputation: 14418

UITextView in custom UITableViewCell not responding to didSelectRowAtIndexPath

I have a UITextView in my custom UITableViewCell and the issue is that when I tap on it it won't respond to the didSelectRowAtIndexPath or even swipe events. How can I fix this? This UITextView is not editable. The reason why I use this over a UITextField is because I want to be able to detect links easily.

Upvotes: 6

Views: 5628

Answers (5)

Ratz
Ratz

Reputation: 119

Check if your TableView Selection property is set to NO

Wrong : tableView.allowsSelection = false

DidSelect Wont be called It has to be: tableView.allowsSelection = true

Also Check your Nib

Upvotes: -2

PickledHerring
PickledHerring

Reputation: 121

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

Upvotes: 12

Reimond Hill
Reimond Hill

Reputation: 4760

I don't know if it's what are you looking for But in my case i had a custom cell with UIImage, and UITextView and only when I clicked on UIImageView i got didSelectRowAtIndexPath recogniser. Make sure UITextView is user interections unable like that to fix the problem

Upvotes: 0

Yorxxx
Yorxxx

Reputation: 526

The first idea that came to mind...

In cellForRow set the textfield tag as the indexpath.row

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

Based on this textView.tag, call the selectrow

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

Upvotes: 0

Hanuman
Hanuman

Reputation: 642

you need to forward the touch messages from UITableView to UITextView

UITextView inside UITableView

Upvotes: 2

Related Questions