how to implement marquee label in IOS using swift

Munkhbold Enkhtur picture Munkhbold Enkhtur · Oct 8, 2015 · Viewed 15.4k times · Source

How to implement MarqueeLabel in iOS. I found example in Objective-C but I'm using Swift.

Answer

Uma Madhavi picture Uma Madhavi · Oct 8, 2015

For creating marquee in swift Add Below Class in your Project https://github.com/cbpowell/MarqueeLabel

To do this first add the pod: pod 'MarqueeLabel'.

And perform a pod update in your project.

Then import pod in your working file: import MarqueeLabel

Create one label and set the custom class as MarqueeLabel in the storyboard. Then:

@IBOutlet weak var marqueeLabel:MarqueeLabel!

In ViewDidLoad add this:

marqueeLabel.type = .Continuous
marqueeLabel.scrollDuration = 5.0
marqueeLabel.animationCurve = .EaseInOut
marqueeLabel.fadeLength = 10.0
marqueeLabel.leadingBuffer = 30.0
marqueeLabel.trailingBuffer = 20.0