I'm trying to add an icon (downward) when the user pulls the tableView to refresh.
the icon shows(downward indicator) to the user.
here my code is
var refreshControl = UIRefreshControl()
let arr = ["first row ","2nd row ","3rd row ","4th row ","5th row ","6th row ","7th row ","8th row ","9th row"]
@IBOutlet weak var tableView: UITableView!
override func viewDidLoad() {
super.viewDidLoad()
refreshControl.addTarget(self, action: #selector(self.refresh(_:)), for: .valueChanged)
tableView.addSubview(refreshControl)
tableView.rowHeight = 160
}
@objc func refresh(_ sender: AnyObject) {
refreshControl.endRefreshing()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return arr.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = arr[indexPath.row]
return cell
}
but I want a downward arrow icon on collectionView before the refresh indicator