how Marquee text of label on swift?

后端 未结 4 508
我寻月下人不归
我寻月下人不归 2021-01-17 08:42

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.

4条回答
  •  庸人自扰
    2021-01-17 09:14

    I Founded even Much Better Solution !

    I Combined 2 Different method together

    here with this code in swift you can do Marquee with ultimate repeat and very simple ! Just put Your Label Out side of Display View.

     UIView.animateWithDuration(8.0, delay:0, options: [.Repeat], animations: {   
            self.YOURLABELNAME.frame = CGRectMake(self.YOURLABELNAME.frame.origin.x - 500, self.YOURLABELNAME.frame.origin.y - 0, self.YOURLABELNAME.frame.size.width, self.YOURLABELNAME.frame.size.height)
            }, completion: nil)
    

提交回复
热议问题