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

This video will teach you how to hook up the interactive graph with the ticker and create a seamlessy scrolling price.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5298-reproducing-popular-ios-controls/lessons/20

Great tutorial. I believe there’s a bug around this code:

      if !cell.isScrolling {
        cell.tableView.scrollToRow(at: charIndexPath, at: .middle, animated: true)
      }

If you scroll fast enough on the graph view, the graph and ticker values could mismatch since we’re skipping some values.

Yep, that’s true! Would have to make sure to move to the correct number once we detect a full stop! We can tap into the scroll view methods to detect whether the user has stopped and make sure that we’re showing the right number.

Great Tutorial.

For Xcode v9.4.1:

  1. AppDelegate.swift:

CHANGE

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
   return true
 }

TO

 func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    return true
 }
  1. ViewController.swift - Line: 64

CHANGE

    addChild(tickerControl)

TO

    addChildViewController(tickerControl)
  1. ViewController.swift - LINE: 75

CHANGE

    tickerControl.didMove(toParent: self)

TO

    tickerControl.didMove(toParentViewController: self)
  1. TickerCell.swift - LINE: 45

CHANGE

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
    super.init(style: style, reuseIdentifier: reuseIdentifier)
    setUpViews()
}

TO

  override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
    super.init(style: style, reuseIdentifier: reuseIdentifier)
    setUpViews()
  }

@adm73 Thank you for performing the changes - much appreciated!