Why is -didDeselectRowAtIndexPath not being called?

后端 未结 10 1749
梦如初夏
梦如初夏 2020-11-29 05:38

I created a fresh project (Xcode 4, Master-Detail application) just to see if I\'m doing something wrong, but I still have the same problem. I want to call -reloadData

相关标签:
10条回答
  • 2020-11-29 06:31

    I think it's just simple mistake! Why don't you use following:

    [self.tableView deselectRowAtIndexPath:indexPath animated:YES];
    

    Instead of using just "tableView" in that line?
    I guess, and pretty sure that above line would give you the solution!
    hope this helped you, if you looked back at your old question!!!
    Kudos! :)

    0 讨论(0)
  • 2020-11-29 06:35

    One other quirk that I've found — in IOS 5.1, at any rate — is that if you call reloadData on the table, you won't get didDeselectRowAtIndexPath for any selected rows. In my case, I adjust the cell layout slightly depending on whether it's selected or not, so I needed to manually do that work prior to reloading the table data.

    0 讨论(0)
  • 2020-11-29 06:35

    Set allowsMultipleSelection for that tableview to TRUE

      self.tableView.allowsMultipleSelection = YES;
    
    0 讨论(0)
  • 2020-11-29 06:42

    I know this is an old question but I just ran into the same problem.

    If you use

    [tableView reloadData]
    

    Then The table data is reloaded and no rows are selected behind the scenes - meaning

    only

    didSelectRowAtIndexPath
    

    is ever called. I hope this helps someone who comes across this problem.

    0 讨论(0)
提交回复
热议问题