0

What I want to do is to show vertical scroll bar (indicator) always, even after I call tableView.reloadData().

I found some good solution without reloadData(), like https://stackoverflow.com/a/15613852/8963597 or https://stackoverflow.com/a/40890158/8963597, but once I do call reloadData() since the number of items and content of tableView should change, indicator shows a wrong position/has the wrong size (Sometimes, it should go away, since there is no need for scrolling)

Brian Hong
  • 930
  • 11
  • 15

1 Answers1

0

This is a little embarrasing, but I just solved the problem not long after I asked this question, though I spent some hours for the solution.

Here is what I did: I followed https://stackoverflow.com/a/15613852/8963597, then I did the following whenever I need to change the content of the tableView:

tableView.reloadData()
tableView.scrollToRow(at: IndexPath(row: 0, section: 0), at: .top, animated: true)
tableView.flashScrollIndicators()

Hope this saves some hours for some.

Brian Hong
  • 930
  • 11
  • 15