These two columns needed to be scrolled automatically (like marquee). But I am having problem to do this. I found two solutions but unfortunately none of these worked.
Any help is greatly appreciated.
Try this:
let label = UILabel()
override func viewDidLoad() {
super.viewDidLoad()
label.frame = CGRectMake(320, 100, 200, 60)
label.text = "This is my music line"
self.view!.addSubview(label)
NSTimer.scheduledTimerWithTimeInterval(2.0, target: self, selector: #selector(self.LabelAnimate), userInfo: nil, repeats: true)
}
func LabelAnimate() {
UIView.animateWithDuration(3.0, delay: 0.0, options: .TransitionNone, animations: {() -> Void in
self.label.frame = CGRectMake(-320, 100, 200, 60)
}, completion: {(isDone: Bool) -> Void in
self.label.frame = CGRectMake(320, 100, 200, 60)
})
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.