简体   繁体   中英

Swift Pull to Refresh with UIViewController without TableView or TableViewController

Is it possible to add a pull to refresh in a normal UIViewController that does not have a tableview or tableviewcontroller? I want the functionality to repopulate some fields that I have in my view controller.

Are you using a UIScrollView or UICollectionView? In both of those cases you can add UIScrollViewDelegate methods, specifically scrollViewDidScroll to your delegate and there begin your update when you want to.

If you are not using a scroll view, you could use a UIPanGestureRecognizer to do the job.

You have to make your own. You can eg use UIScrollView for this.

you can use this custom control ( https://github.com/spbvasilenko/VASRefreshControl ) it can be used with a scroll view.you will need to put your view in scroll view. hope it helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM