1

for some time I was using code like

extension UIRefreshControl {
    func beginRefreshingManually() {
      if let scrollView = superview as? UIScrollView {
        scrollView.setContentOffset(CGPoint(x: 0, y: scrollView.contentOffset.y - frame.height), animated: false)
      }
      beginRefreshing()
}}

To start manually refreshing (show spinning circle) in viewDidLoad of UIViewControllers and it works like a charm.

After migrating to swift 3.0 and iOS 10 it suddenly stops. Moreover, I tried to move invocation into viewDidAppear, and for my frustration, on some controllers it works, and on some not (If there is any pattern, I was unable to find it)

any solutions ?

cheers Wojtek

wojciech_maciejewski
  • 1,277
  • 1
  • 12
  • 28
  • check the solution here: http://stackoverflow.com/questions/28550021/uirefreshcontrol-not-refreshing-when-triggered-programmatically it works for iOS 10, swift 3 – Adam Różański Oct 28 '16 at 09:53

1 Answers1

1

There is a change in UIRefreshControl for iOS 10. You have been adding refresh control like this: scrollView.addSubview(refreshControl). Now, ScrollView, CollectionView and TableView have refreshControl property, so this is a code now: scrollView.refreshControl = refreshControl

Flipper
  • 1,107
  • 1
  • 11
  • 32