I want to create a marquee label in Swift. I tried some codes but could not get it to work.
I also can do this with animation but I have problem with repeating it.>
I don't know why I got 2 - ?!???
I tried many things. that doesn't matter anymore...
I found this 5 min ago and thats my answer for using animation instead of marquee. but on iOS marquee is a tough problem !
here is the link that solved my repeating animation problem
I used this code and it Works ! wish to help others too.
on ViewdidLoad :
if let aLabel = self.txtAmarFull {
aLabel.pushTransition(3)
}
on Body:
extension UIView {
func pushTransition(duration:CFTimeInterval) {
let animation:CATransition = CATransition()
animation.timingFunction = CAMediaTimingFunction(name:
kCAMediaTimingFunctionEaseInEaseOut)
animation.type = kCATransitionMoveIn
animation.subtype = kCATransitionFromLeft
animation.duration = duration
animation.repeatCount = 99
self.layer.addAnimation(animation, forKey: kCATransitionPush)
}
my label name is : txtAmarfull