Label moving as a digital marquee

0

Hello, I would like to know how I do in Swift a sentence moving from right to left and when every sentence passes it is doing the same procedure forever, like a digital marquee.

    
asked by anonymous 14.03.2016 / 19:20

1 answer

1

To create this label effect by moving ( called Marquee effect ) you can use this library: link

If you are using cocoapods just add pod 'MarqueeLabel-Swift' to your podfile, or if you want to manually add just put the class MarqueeLabel.swift into your project.

Now just create a label in your storyboard and put her class as custom MarqueeLabel type and connect with your @IBOutlet:

  @IBOutlet weak var marqueeLabel: MarqueeLabel!

  override func viewDidLoad() {
    super.viewDidLoad()

    marqueeLabel.type = .Continuous
    marqueeLabel.scrollDuration = 5.0
    marqueeLabel.animationCurve = .EaseInOut
    marqueeLabel.fadeLength = 10.0
    marqueeLabel.leadingBuffer = 30.0
    marqueeLabel.trailingBuffer = 20.0
  }
    
14.03.2016 / 21:42