如何实施跑马灯标签在 iOS 中。我在 Objective-C 中找到了示例,但我使用的是 Swift。
用于在 swift 中创建选取框,在项目中添加下面的类https://github.com/cbpowell/MarqueeLabel
为此,首先添加 pod:pod 'MarqueeLabel'
.
并执行一个pod update
在你的项目中。
然后将 pod 导入到您的工作文件中:import MarqueeLabel
创建一个标签并将自定义类别设置为MarqueeLabel
在故事板中。
然后:
@IBOutlet weak var marqueeLabel:MarqueeLabel!
在 ViewDidLoad 中添加以下内容:
marqueeLabel.type = .Continuous
marqueeLabel.scrollDuration = 5.0
marqueeLabel.animationCurve = .EaseInOut
marqueeLabel.fadeLength = 10.0
marqueeLabel.leadingBuffer = 30.0
marqueeLabel.trailingBuffer = 20.0
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)