Label moving as digital signage

Asked

Viewed 85 times

0

Hello, I would like to know how I do in Swift a phrase keep passing from right to left and when every sentence pass she keep doing the same procedure forever, like a digital sign.

1 answer

1


To create this effect of the label moving (so-called Marquee effect) you can use this library: https://github.com/cbpowell/MarqueeLabel-Swift

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

Now just create a label on 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
  }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.