Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flash scroll indicators don't work

I got my table view on top of a map view. I want to show to user that the tableView is scrollable. Here is my previos thread: Swift - How to attach bar to the top of table view?

I tried using

self.tableView.flashScrollIndicators()

in my ViewDidLoad() method but this doesn't change anything, the table view looks exactly the same as before. I read suggestion that it might be caused by reloading tableView and filling it with data, whilst created tableView is empty. Nonetheless I tried pasting the flashScrollIndicators() method in other project where table is created with cells immediately - again no significant difference.

Am I doing something wrong or using the method in wrong place?

like image 547
theDC Avatar asked Dec 03 '22 17:12

theDC


1 Answers

If anyone is still fighting with this problem here is my working solution - works on iOS 11. In my case flashScrollIndicators() did not work on first invocation of viewDidAppear(animated:). Invoking flashScrollIndicators() with a delay will do the trick.

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        DispatchQueue.main.asyncAfter(deadline: (.now() + .milliseconds(500))) {
            self.collectionView.flashScrollIndicators()
        }
    }
like image 140
Baran Emre Avatar answered Dec 27 '22 15:12

Baran Emre