简体   繁体   中英

didSelectRowAtIndexPath doesn't work on xCode 9

So I have to work on this really big project, it's still on objective C.

I was just ask to make a really small change (hide a button) so I did that and it's building fine and everything looks normal but then all of the tableView in the project won't react as in didSelectRowAtIndexPath is never called (scrolling work and the data are correctly displayed)

The only thing that changed compared to before is that I used xCode 9.

Now when I build it using xCode 8 it's working again so at least we can go ahead but I still am wondering what is happening.

I made a smaller project using exactly the same logic as the main project (the cell are custom, you can swipe etc) and when I did it from scratch, it's working fine.

So I fell like it's more of an xCode bug/error than one with the code. would someone have any idea ?

Have you used tap anywhere on that UI?? because when tap: UITapGestureRecognizer is there in UI didselect work after only at longpress of cell

or you can just set in your viewdidload function

UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKeyboard)];
[self.tableView addGestureRecognizer:gestureRecognizer];
gestureRecognizer.cancelsTouchesInView = NO; 

Please check the following

在此处输入图片说明 It should be single selection

在此处输入图片说明 It should be interaction enabled

And check you have created any button on top of all layers which is targeting some other action.

Check it and reply.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM