Reproducing Popular iOS Controls - Part 19: | Ray Wenderlich Videos

In this video we'll discuss the ticker control and see how to implement it.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5298-reproducing-popular-ios-controls/lessons/19
if !cell.isScrolling {
    cell.tableView.scrollToRow(at: charIndexPath, at: .middle, animated: true)
} 

This code looks like it will solve the continuing scrolling issue, but it will cause a wrong value at the end sometimes.
Here is a way to make sure it scrolls to the final value.

var isScrolling = false {
    didSet {
        if isScrolling == false,
           currentIndex != finalIndex {
            tableView.scrollToRow(at: finalIndex, at: .middle, animated: true)   
        }
    }
}

But scrolling from a wrong value to final value makes no sence to user.
So I think leaving the continuing scrolling issue over is a better idea than trying to solve it without creating a custom scrolling animation.

1 Like

@ihsan Thank you for sharing your solution - much appreciated!