0

Everything is ok, but why is didselect not being called

-(void)viewDidLoad { self.tableView.dataSource=self; self.tableView.delegate=self; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ NSLog(@"did select row not called**strong text**"); } 
6
  • 2
    Maybe unrelated but you have to call super in viewDidLoad. Commented Feb 4, 2020 at 10:57
  • call but nothing happen Commented Feb 4, 2020 at 10:58
  • i think you want expand/collaps your cell as per click on cell. right ? Commented Feb 4, 2020 at 11:02
  • yes its working Commented Feb 4, 2020 at 11:07
  • what fixed the issue post it as answer and accept Commented Feb 4, 2020 at 12:16

1 Answer 1

1

Reason to add these two lines in viewDidLoad is that when use gesture UIGestureRecognizer then didSelectRowAtIndexPath not work after adding these line its work

self.tableView.allowsSelection = YES;

self.tableView.userInteractionEnabled = YES;

 -(void)viewDidLoad { self.tableView.dataSource=self; self.tableView.delegate=self; self.tableView.allowsSelection = YES; self.tableView.userInteractionEnabled = YES; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ NSLog(@"did select row being called"); } 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.