Last Updated: August 15, 2018
· 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];
Say Thanks

3 Responses
Add your response


very useful.

over 1 year ago ·
Me3 normal

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 ·

I'm not really much of a swift developer but I did manage to port one of my Android apps to iOS a few months ago.

That has been well received, but unfortunately the pull to refresh functionality doesn't work on iOS 10. The existing app store version works fine for earlier versions of iOS, but once users upgrade to iOS 10 they can no longer update the data in the main uitableview.https://www.7zip.vip/

I downloaded Xcode 8 and the iOS10 SDK, but no matter if I use the existing swift 2.3 code or auto-convert it to swift 3 the pull-to refresh functionality still doesn't work in the iOS10 simulator (I don't actually own any iOS devices to test with).
The worst part is that it doesn't give any errors, swiping down on the uitableview just doesn't do anything.


5 days ago ·