UITableView
is one of the most versatile
UIView
s in
UIKit
. It can be used in so many ways, the mind boggles. And it's greatest benefit is efficiently showing data (as cells) with low overhead. It not only can restrict generating UI to only the cells that are shown in an efficient manner, it can also update its UI with animations in a very efficient manner using
deleteSections:withRowAnimation:
,
reloadSections:withRowAnimation:
,
insertSections:withRowAnimation:
,
moveSection:toSection:
,
deleteRowsAtIndexPaths:withRowAnimation:
,
reloadRowsAtIndexPaths:withRowAnimation:
,
insertRowsAtIndexPaths:withRowAnimation:
, and
moveRowAtIndexPath:toIndexPath:
. But what if the management of the data source that backs the table view isn't maintained by your application? What if you have a REST API that returns a JSON data structure that you use to populate your
UITableView
? If that data ever changes on a subsequent GET, you have little choice but to perform a
reloadData
, right? No way! We're
PROgrammers! We can tackle this!
Dynamically updating a UITableView