A Neat Solution to Placing Refresh Button in a Table View

Today I came across an interesting approach to placing a refresh button in a UITableView: the user can simply drag down the table view to refresh the table content!

During the refresh process, the user sees the process indicator view just above the 1st row of the table:

When the table data is refreshed, the process indicator view hides with animation!

This solution is based on the fact that a table view is derived from UIScrollView class. Having implemented the UIScrollViewDelegate methods we can easily spot the moment when the user has dragged down the table enough to display the process indicator view above it. Then we can update our table’s contentInset property with animation effect to shift the table view down.

You can have a look at the source code by enormego at Github.