Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy does my UITableView lose it's fluidity when I scroll during an asynchronous reload data?
    text
    copied!<p>Here is my problem... I'm making an asynchronous call to the service I'm working with, which returns search results back to me. When that's done, it reloads my table, and the async is done. The problem is, when I try scrolling on my table view before the async call is done, the table loses that fluid feeling that all scroll views have. What I mean by this is that when you let go of the scroll, rather than keeping going and slowly stopping, it just halts as soon as you let go. The only way to restore the fluid feeling is to scroll all the way to the top or bottom of the UITableView and a little past, then it's fine. </p> <p>Here is my code for the async call:</p> <pre><code>__block NSMutableArray *appendMoreObjects = [[NSMutableArray alloc] init]; dispatch_async( dispatch_get_main_queue(), ^{ self.activity.hidden = NO; appendMoreObjects = [service search:self.query from:((moreCount * 8)) until:((moreCount * 8) + 8)]; if( appendMoreObjects == nil ) { //alert view } else { [self.allSearchResults addObjectsFromArray:appendMoreObjects]; [self updateSearchArray]; self.moreCount += 1; } self.activity.hidden = YES; }); </code></pre> <p>Also, keep in mind that I'm using a custom UITableViewCell. If any other information is needed, please request it and I'll see what I can do. Thank you in advance.</p> <p>EDIT1: [self updateSearchArray] contains the [tableView reloadData]</p> <p>EDIT2: I'm testing on an iPod Touch running 4.3.1 (8G4)</p> <pre><code>-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { customCell * cell = (customCell *)[tableView dequeueReusableCellWithIdentifier:@"cell"]; if( cell == nil ) { cell = [[[customCell alloc] initWithFrame:CGRectZero] autorelease]; } if( indexPath.row == [self.searchResults count] &amp;&amp; [self.searchResults count] &gt; 0) { UITableViewCell *moreCell = [[[UITableViewCell alloc] initWithFrame:CGRectZero] autorelease]; moreCell.textLabel.text = @"More"; moreCell.textLabel.textAlignment = UITextAlignmentCenter; return moreCell; } if( indexPath.row &lt; [self.searchResults count] ) { [cell formatAndInsertData:[self.searchResults objectAtIndex:indexPath.row]]; } return cell; } </code></pre> <p>Solution:</p> <p>What I actually ended up doing was locking down the table and all UI elements until the call was done. Maybe not the best solution, but it worked none the less.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload