Want to add the pull to refresh in bottom of tableview.
First want to show the numbers in tableview 100 to 90.
Then add the pull to refresh in bottom of tableview. pull it want to display 80 to 70, then pull refresh 70 to 60, then pull refresh 50 to 40... etc final 1 to 10 means get stoped display "no data available". how to achieve this. help me thanks advance.
Here my code.
@IBOutlet weak var dataTbl: UITableView!
var numbers: [Any] = ["90","91","92","93","94","95","96","97","98","99","100"] // display first 100 to 90.
Loaded in tableview.
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.numbers.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell:UITableViewCell = self.dataTbl.dequeueReusableCell(withIdentifier: cellReuseIdentifier) as UITableViewCell!
cell.textLabel?.text = self.numbers[indexPath.row] as? String
return cell
}
searched in google for add the refresh in buttom of tableview. i got this code.
let spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray)
spinner.color = UIColor.darkGray
spinner.hidesWhenStopped = true
tableView.tableFooterView = spinner
show spinner using
spinner.startAnimating()
hide it using
spinner.stopAnimating()
By using this code how to do pull to refresh help me.