这两列需要自动滚动(如选框)。但我这样做有问题。我找到了两个解决方案,但不幸的是,这些解决方案都没有。
答案 0 :(得分:-1)
试试这个:
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)
})
}
}