Using the UIRefreshControl with the UICollectionView in Xamarin.iOS

If you have used Twitter on an iPhone, you are familiar with the concept of pull to refresh.  When you work with a UITableViewController, there is a .Refresh property that can be used to assign  a Refresh Control to.  A UICollectionViewcontroller has many similarities.  Unfortunately, the .RefreshControl property is not one of them.  How in the heck are you supposed to provide the same functionality in the UICollectionViewController?  It is actually rather simple, but not documented by Apple.  I found this on Stack Overflow and translated it to Xamarin.iOS.  The steps are:

  1. Create the UIRefreshControl just like you would with the UITableViewController.  Set properties on the UIRefreshControl just like you have previously.
  2. Add the UIRefreshControl as a subview on the UICollectionViewController's .CollectionView. 

There you go, now pull down in your UICollectionView in the UI and boom, there you have what you want.

No Comments