2

I'm having hard time to end the pull to refresh feature.

Even if I call the endRefreshing() on refershControl, the spinner stays there. The tableview is refreshed properly though.

Here is my swift code :

@IBAction func refereshInvoked() {
    refresh_data()
    self.refreshControl.endRefreshing()
}

Since I'm pretty new with Swift and Cocoa, I'm probably doing something wrong.

Thank you

Daniyar
  • 2,975
  • 2
  • 26
  • 39
rgagnon
  • 114
  • 7

1 Answers1

0

Do you actually set the refresh control? Put a break point in the code under refreshInvoked, then check that self.refreshControl is not NULL/nil.

Performing endRefreshing method on a nil object would compile but obviously nothing would happen. If it is nil then you need to create the refresh control object on viewdidload.

Reedy
  • 1,866
  • 2
  • 20
  • 23
  • In Swift, a non-optional variable (such as `self.refreshControl`, note the missing `?` suffix) cannot be nil. – cutsoy Nov 28 '14 at 16:18