Перемещение UILabel
справа налево. Добавьте правильный constraints
к вашей текстовой метке, и если вы хотите получить анимацию справа налево, установите текст Alignment
вправо
func updateLabels() {
self.myTimer = Timer.scheduledTimer(withTimeInterval: 2, repeats: true) { (t) in
self.titleLabel.text = self.titleArray[self.counter]
self.textLabel.text = self.textArray[self.counter]
DispatchQueue.main.async(execute: {
UIView.animate(withDuration: 5.0, delay: 1, options: ([.curveLinear, .repeat]), animations: {() -> Void in
self.textLabel.center = CGPoint(x:0 - self.textLabel.bounds.size.width/2, y:self.textLabel.center.y)
}, completion: nil)
})
self.counter += 1
if self.counter == self.titleArray.count && self.counter ==
self.textArray.count {
self.counter = 0
}
}
}