UA-17470720-3

Jump to content


Photo
- - - - -

SCSearchViewController and Cancel behaviour


  • Please log in to reply
2 replies to this topic

#1 quimarche

quimarche

    Starting Out

  • STV Lite
  • Pip
  • 5 posts
Reputation: 1
Good

Posted 12 April 2014 - 08:23 AM

I have implemented a CoreData-backed SCSearchViewController which works just fine. However, if I enter a search term that returns one or more rows, then click search, then delete the search term, then click cancel, I'm left with zero rows.

 

Even simpler test, click search, then click cancel. Nada.

 

Please can someone explain why I'm not seeing any data and, if possible, how to fix it?

 

Regards

 

Chris


Edited by quimarche, 12 April 2014 - 09:05 AM.


#2 quimarche

quimarche

    Starting Out

  • STV Lite
  • Pip
  • 5 posts
Reputation: 1
Good

Posted 12 April 2014 - 09:31 AM

Tarek

 

I think I might have a fix for this. My suspicion is that it's a threading issue, and that the reload/redraw of the tableview cells is in a race condition with the removal of the search bar. You can see this in action by clicking search, then clicking cancel, then scrolling down. The cells off the bottom of the screen are rendered just fine. It's the ones at the top that are causing a problem. They are there, just not redrawn.

 

I've read other posts about empty/white cells being displayed when none are expected.

 

File: SCTableViewModel.m

Selector: searchBarCancelButtonClicked:

 

// [self.tableView reloadData];

    dispatch_async(dispatch_get_main_queue(), ^{

        [self.tableView reloadData];

    });



#3 devia

devia

    Jr. Member

  • STV 3.0 Pro
  • PipPip
  • 20 posts
Reputation: 8
Good

Posted 20 April 2014 - 04:34 PM

I have the same trouble. Thank you very much@


Edited by devia, 20 April 2014 - 04:34 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users