iOS开发-label文字滚动

实现效果如图

代码如下

 1 /**
 2      *  labelShow  展示文字的label,将label位置设置在屏幕左侧以外。
 3      */
 4     CGRect frame = labelShow.frame;
 5     frame.origin.x = -180;
 6     labelShow.frame = frame;
 7     
 8     
 9     
10     [UIView beginAnimations:nil context:NULL];
11     [UIView setAnimationDuration:8.8f];
12     [UIView setAnimationCurve:UIViewAnimationCurveLinear];     
13     [UIView setAnimationRepeatAutoreverses:NO];
14     [UIView setAnimationRepeatCount:MAXFLOAT];
15     
16     /**
17      *  label结束位置设置在屏幕右侧以外
18      */
19     frame = labelShow.frame;
20     frame.origin.x = 350;
21     labelShow.frame = frame;
22     [UIView commitAnimations];      
原文地址:https://www.cnblogs.com/dingjianjaja/p/5038119.html