Skip to content

Adding UIRefreshControl to a table view

Addind a simple UIRefreshControl to a UIScrollView

Section titled “Addind a simple UIRefreshControl to a UIScrollView”

We assume a fully working UIScrollview named _scrollView;

Note that UITableView, UICollectionView are also scrollviews, hence the following examples would work on those UI elements.

First, creation & allocation

UIRefreshControl refreshControl = new UIRefreshControl();

Second, connecting the refresh event to a method. There are different ways to do that.

refreshControl.ValueChanged += (object sender, EventArgs e) => MyMethodCall();
refreshControl.ValueChanged += (object sender, EventArgs e) =>
{
//Write code here
};
refreshControl.ValueChanged += HandleRefreshValueChanged;
void HandleRefreshValueChanged(object sender, EventArgs e)
{
//Write code here
}

Third and last, adding the refresh control itself to our scrollview.

_scrollView.AddSubview(refreshControl);