UITableView reloaddata doesn't reload immediately

Posted by D33 on Stack Overflow See other posts from Stack Overflow or by D33
Published on 2010-12-27T11:44:11Z Indexed on 2010/12/28 2:53 UTC
Read the original article Hit count: 234

Filed under:
|

Hi everyone.

I'm trying to work with online data in my iPhone app. But I'm getting mad because of this:

I have object for downloading data with NSURLConnection. Method starting the work with connection (and other stuff) in separate thread - [ NSThread detachNewThreadSelector:@selector( doConnectionInNewThread ) toTarget: self withObject: nil ];

When data are loaded (connectionDidFinishLoading) I give them to my viewController. This all stuff works fine. When I use breakpoints or NSLog I have the data ready to show in UITableView. When I call reloadData, nothing happens immediately. It reloads data after maybe 2 seconds (- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath is called after this delay).

BUT when I slide the tableView, it reloads data immediately. So the connection and so on works fine but it just doesn't reload the data. Why? I thought it could be due to blocked mainThread by URLConnection. But now I use it in separate thread and it is still the same...

© Stack Overflow or respective owner

Related posts about iphone

Related posts about cocoa-touch