ios - What is a good way to display a spinner at the bottom of a tableview when a user scrolls, but the tableview cells load slowly? -


i have uitableview displays content. when user scrolls upward, cells below don't load immediately. creates area of white space @ bottom of table. display spinner in white space , have disappear when content done loading, i'm not sure how go doing this. way implement in swift?

i new coding , ios, please forgive me if question vague or answer obvious.

sample screenshot :

sample image desired behavior

i think it's helpful you..

func tableview(_ tableview: uitableview, willdisplay cell: uitableviewcell, forrowat indexpath: indexpath) {     let lastsectionindex = tableview.numberofsections - 1     let lastrowindex = tableview.numberofrows(insection: lastsectionindex) - 1     if indexpath.section ==  lastsectionindex && indexpath.row == lastrowindex {         // print("this last cell")         let spinner = uiactivityindicatorview(activityindicatorstyle: .red)         spinner.startanimating()         spinner.frame = cgrect(x: cgfloat(0), y: cgfloat(0), width: tableview.bounds.width, height: cgfloat(44))          self.tableview.tablefooterview = spinner         self.tableview.tablefooterview?.ishidden = false     } } 

tablefooterview should hide when data load. when above function isn't work can prefer link.


Comments

Popular posts from this blog

Add new key value to json node in java -

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

javascript - Highcharts Synchronized charts with missing data points -