2015ztlucky

导航

iOS 的文字滚动条效果的实现

UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(50, 100, 300, 50)];

    label.text  = @"欢迎欢迎欢迎";

    [self.view addSubview:label];

    

    [label sizeToFit];

    CGRect frame = label.frame;

    frame.origin.x = 320;

    label.frame = frame;

    

   [UIView beginAnimations:@"testAnimation" context:NULL];

    [UIView setAnimationDuration:8.8f];

    [UIView setAnimationCurve:UIViewAnimationCurveLinear];

    [UIView setAnimationDelegate:self];

    [UIView setAnimationRepeatAutoreverses:NO];

    [UIView setAnimationRepeatCount:999999];

    

    frame = label.frame;

    frame = label.frame;

    frame.origin.x = -frame.size.width;

    label.frame = frame;

    [UIView commitAnimations];

 

posted on 2016-09-12 13:02  2015ztlucky  阅读(329)  评论(0编辑  收藏  举报