关于iOS label实现跑马灯效果

UILabel *label3 = [[UILabel alloc] initWithFrame:CGRectMake(10,200, self.view.bounds.size.width, 100)];
label3.backgroundColor = [UIColor redColor];
label3.text =@"噜啦啦噜啦啦噜啦噜啦噜,噜啦噜啦噜啦噜啦噜啦噜~~~";
[self.view addSubview:label3];

CGRect frame = label3.frame;
frame.origin.x = -180;
label3.frame = frame;
[UIView beginAnimations:@"testAnimation"context:NULL];
[UIView setAnimationDuration:8.8f];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDelegate:self];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationRepeatCount:999999];
frame = label3.frame;
frame.origin.x =350;
label3.frame = frame;
[UIView commitAnimations];
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容