Strange behavior. Did the row row choose not to respond to a UITableViewCell

I have a very strange problem, I don’t know if this is inconvenient for the normal behavior of the cells or not, it seems that it is! Therefore, I give it to someone who can answer, apologize if any thing is stupid in the matter of this question. Usually, when we touch a table cell, what happens is what happens, it goes to the view controller / controller that is encoded. Now, what is strange here, it does not respond to the selection, or touch.I checked whether the selection allows or not when editing is selected in IB or not. I selected it, now the twist is here, when I touch the cell of the table, it does not respond, instead, when I scroll it horizontally / when I press for a long time I don’t understand the reason why I need to scroll it to make a cell selection in operating mode table. This also happens with the button under the table view!

I was looking for problems similar to my case, but I found only one question there, it was suggested to check this method,

-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath 

But I did not implement this method at all, that I actually have a tab bar with several elements, where I have a controller called AddController, for accessing several attributes and strings, etc., declared in the controller, I subclass it in the following way:

 @interface ViewController : AddController 

Now, since it was indicated in the question I saw, i.e. the link I gave to check if you copy the same code on the controller page of the subclass, I talked about the subclass and what I did, I hope everyone understands this!

Can anyone advise me on how to get out of this problem and make the table cell respond to normal strokes, any help is greatly appreciated!

Thanks to everyone in advance :)

+2
iphone uitableview didselectrowatindexpath
Mar 30 '12 at 8:33
source share
3 answers

After some research, I am sure that this UITapGestureRecognizer in the tableView caused you a problem. If you were like me with a text box in a cell and using UITapGestureRecognizer to close the keyboard, here is my solution:

In the view you implemented UITextFieldDelegate

(In my case, I have a custom UITableViewCell called TextFieldCell)

Declare UITapGestureRecognizer as a property:

 @interface TextFieldCell : UITableViewCell <UITextFieldDelegate> { UITextField *theTextField; UITapGestureRecognizer *gestureRecognizer; } @property (nonatomic,retain) UITextField *theTextField; @property (nonatomic,retain) UITapGestureRecognizer *gestureRecognizer; 

And initialize it in your view:

 self.gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(closeKeyboard:)]; 

In the method - (void)textFieldDidBeginEditing:(UITextField *)textField use superView to go to the TableView table and call addGestureRecognizer :

 [self.superview.superview addGestureRecognizer:gestureRecognizer]; 

And in - (void)textFieldDidEndEditing:(UITextField *)textField just remove the gesture recognizer:

 [self.superview.superview removeGestureRecognizer:gestureRecognizer]; 

This will completely solve the problem.

+4
May 22 '12 at 5:57
source share

Are you using UITapGestureRecognizer in your TableView? I had the same problem as you have today, and then I realized that it was the gesture recognizer that erases my intention to select a line by pressing. When I deleted it, the View table returned to normal.

Hope this helps.

+1
May 22 '12 at 4:57
source share

I had the same problem and solved it by noting the “Scroll Attribute” in the table view attributes.

I don’t need to scroll in my table view, so it doesn’t affect the application in any other way, except that now I don’t get the first response after a gesture transition.

0
Mar 22 '14 at 12:03
source share



All Articles