1

I use TextView in Collection View Cell. I want TextView always show scroll indicator when its content can be scrollable. I use this method below. But It shows only first after that it disappear. How to make scroll indicator of TextView always show?

override func draw(_ rect: CGRect) {
        super.draw(rect)
        self.descriptionTextView.flashScrollIndicators()
    }
seyha
  • 554
  • 5
  • 16

2 Answers2

1

flashScrollIndicators: It will flash only once when your textView is created or page is loaded.

Set flashScrollIndicators on regular intervals:

let timerTask = Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(refreshFlashIndicator), userInfo: nil, repeats: true)

@objc func refreshCrawlerStatus() {
   self.descriptionTextView.flashScrollIndicators()
}
Mohit Kumar
  • 2,898
  • 3
  • 21
  • 34
0

Currently no public apis available for that. Someone have solution that using timer. But I'd prefer flashing indicator once when view did appeared.

Another idea is making textview contents to scroll to top, so that the user can understand there is content to scroll. Below code copied.

textView.setContentOffset(.zero, animated: true)
Lal Krishna
  • 15,485
  • 6
  • 64
  • 84