关于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];

你可能感兴趣的:(关于iOS label实现跑马灯效果)