开发者

Updating a TableView while an asyncronous update is occurring -- advise please!

开发者 https://www.devze.com 2023-02-09 20:20 出处:网络
Thank you in advance for your help. Background: I have two TableViews (NSArray datasource) that are populated through core data. This works fine (I\'m familiar with coredata), however when the app fi

Thank you in advance for your help.

Background: I have two TableViews (NSArray datasource) that are populated through core data. This works fine (I'm familiar with coredata), however when the app first loads it starts an asynchronous update of all data (and drops data when new data has completed download). I am not using a NSFetchedResultsController.

Problem: This means if you enter the app and quickly click "Grocery Categories List" at a certain point it may not display data as it's being updated.

Navigation Views: (Grocery Categories List) > (Category Items List) > (Item Detail)

Sorry this is a horrible description, it's my first project working asynchronously with data and updating UITableViews. I am only looking for suggestions or a design pattern suggestion 开发者_如何转开发to read up on.

Thank you for your patience!


I would not release any existing data or refresh the table until I have retained the updated data. So:

  1. Launch the app
  2. Feed the old data to the tables and start asynchronous request for new data
  3. Fetch the data, release the old one, retain the new one and reload the table

.

[_dataArray release];
_dataArray = [newData retain];
[_tableViewWithDataArray reloadData];
0

精彩评论

暂无评论...
验证码 换一张
取 消