t0roea
Last Updated: August 15, 2018
·
8.035K
· angrauel
9c18132b3cee0bda425e22e4af300d28

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
Respond

3 Responses
Add your response

672
E5a1d8b4c0856566e5aba753463cb80a

very useful.

over 1 year ago ·
10669
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 ·
30380

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).
https://www.applock.ooo/
The worst part is that it doesn't give any errors, swiping down on the uitableview just doesn't do anything.

https://www.minimilitia.mobi/

5 days ago ·