What is the most reliable way to reload UITableView data?

advertisements

I have found 2 functions to reload my rows of UITableView

1st.

    [tableView reloadRowsAtIndexPaths:[tableView indexPathsForVisibleRows]
                 withRowAnimation:UITableViewRowAnimationNone];

2nd.

    [tableView reloadData];

What is more specific way to reload UITableView Data


Both are "reliable" and possibly "specific" (depending on what you mean by specific) -- in fact, there are even more ways:

reloadData
reloadRowsAtIndexPaths:withRowAnimation:
reloadSections:withRowAnimation:
reloadSectionIndexTitles

Check the developer documentation (https://developer.apple.com/library/ios/documentation/UIKit/Reference/UITableView_Class/index.html) on the differences, but the short answer is that they are all reliable -- it just depends on how much information you want to reload, and if you want to do it with animation.

For example, if you only want to reload certain rows, you can use reloadRowsAtIndexPaths:withRowAnimation:. If you want to reload a whole section, use reloadSections:withRowAnimation:.