Last Updated: September 09, 2019
· angrauel

UIRefreshControl in any UIScrollView

Apple documentation only explains how to use an UIRefreshControl in an UITableViewController, but what do you do if you want to add it to any UIScrollView?

UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init];
[refreshControl addTarget:self action:@selector(handleRefresh:) forControlEvents:UIControlEventValueChanged];
[self.scrollView addSubview:refreshControl];

2 Responses
Add your response

very useful.

over 1 year ago ·

Hi Andreas,
I'm facing a problem with this.
I'm adding content in my scrollview on refreshing, and in the process, my contentview of the scrollview resets to a height of 1pt and resizes to a bigger area.
Now, when I pull down to refresh, the UIRefreshControl is missing!

over 1 year ago ·