Assertion failure when using UISearchDisplayController in UITableViewController

后端 未结 7 2031
一个人的身影
一个人的身影 2020-12-07 12:55

I\'ve been trying to add simple Search functionality to a TableViewController in my app. I followed Ray Wenderlich\'s tutorial. I have a tableView with some data, I added th

相关标签:
7条回答
  • 2020-12-07 13:57

    After searching, 'tableView' of cellForRowAtIndexPath method seems not an instance of the Table that you define. So, you can use an instance of a table that defines the cell. Instead of:

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    

    Use:

    UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
    

    (Do not use the tableView of cellForRowAtIndexPath method, use self.tableView.)

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