Search code examples
iosswiftswift3tableviewuirefreshcontrol

Change Pull To Refresh Activity Indicator


I have an ActivityIndicator on my tableView which appears when I pull to refresh.

I was wondering if I can change the color of the spinning indicator, here is my implimentation:

override func viewDidLoad() {
     refreshData()
    super.viewDidLoad()
    self.refreshControl?.addTarget(self, action: #selector(handleRefresh(refreshControl:)), for: UIControlEvents.valueChanged)

}

func handleRefresh(refreshControl: UIRefreshControl) {
    self.tableView.reloadData()
    self.refreshData()
    sleep(2)
    refreshControl.endRefreshing()

}

enter image description here


Solution

  • Simply change the tintColor of refreshControl

    self.refreshControl.tintColor = .red