A marquee UILabel
implementation, which utilises UIScrollView
and CADisplayLink
to scroll long text within a single-line label.
pod 'UIScrollLabel'
Simply set UIScrollLabel
as the subclass of your UIScrollView
object, set the text in code, and you're good to go!
import UIScrollLabel
// ...
let pid = UIScrollLabel(frame: CGRect(x: 0, y: 0, width: screenWidth, height: 60))
pid.font = UIFont.boldSystemFont(ofSize: 40)
pid.textColor = UIColor.red
pid.text = "The next station is KOKKAIGIDJIDOMAE. The doors on the left-hand side will open."
You can set the textColor
and text
right from Interface Builder, too! 🎉
UIScrollLabel
is released under the MIT license.
Presented to you with love, by @topLayoutGuide.