what precautions are required when a UITableView is updating? (e.g. locking it?)
Should one "lock" a UITableView whilst it is updating somehow?
That is, during a data refresh for a UITableView (assuming it takes a few seconds), should one be somehow locking the view itself so that users can't click through on rows etc?
Just wondering what precautions (if any开发者_StackOverflow社区) a developer should take here.
Depends on the context. A common solution, when there’s no guarantee that the contents of the table will still be valid once the load completes, is to cover it with a semitransparent full-screen overlay view displaying an activity indicator or a progress bar. If you’re just loading new data, though—i.e. the old data in the table is still valid, like when you’re refreshing a news feed or similar—there shouldn’t be a need to lock anything.
Set the userInteraction to disabled.
When table is getting updated and its time consuming such as loading numbers of image using url or getting thumbnail of videos playlist or getting data from webservice etc then there is need to use lazy loading of content of in table view cell so there will be no effect of time consuming data in table view as it will be disaplayed when lazy loader has content of data without effecting tableView
精彩评论