关于iOS label实现跑马灯效果

作者: Wo的小名叫单纯 | 来源:发表于2016-06-07 15:32 被阅读5970次

    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实现跑马灯效果

        本文链接:https://www.haomeiwen.com/subject/xpbddttx.html