请问跑马灯效果如何实现两行文字轮流从右向左跑? 一行跑完了,另一行再开始跑,这样循环

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了请问跑马灯效果如何实现两行文字轮流从右向左跑? 一行跑完了,另一行再开始跑,这样循环相关的知识,希望对你有一定的参考价值。

请问跑马灯效果如何实现两行文字轮流从右向左跑? 一行跑完了,另一行再开始跑,这样循环.不是两行一起跑,是一行跑过之后,另一行再开始跑。谢谢了

参考技术A 可以的,加入一段滚动代码就可以了 从右向左滚动<marquee scrollamount=1 scrolldelay=3 valign=middle behavior="scroll">
<img border="0" src=" http://要滚动的图片地址1">
<img border="0" src=" http://要滚动的图片地址2">
</marquee>
从下往上滚动
<marquee onMouseOver="this.stop()" onMouseOut="this.start()" align=center direction=up scrollamount=1 scrolldelay=3 valign=middle behavior="scroll">
<img border="0" src=" http://要滚动的图片地址1">
<img border="0" src=" http://要滚动的图片地址2">
</marquee>
参考技术B 这个简单,普通JS跑马灯代码里加个单复次数判断就行了,

代码笔记iOS-字体从右向左滚动

一,效果图。

二,代码。

ViewController.m

复制代码
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    
    //上面的滚动条
    UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(5, 50, 500, 40)];
    label.text=@"111111111111122222222";
    label.backgroundColor=[UIColor redColor];
    [self.view addSubview:label];
    
    //从右到左滚动
    [self AnimationWithLabel:label];
}

//使字体从右向左滚动
- (void)AnimationWithLabel:(UILabel*)labelShow;
{
    CGRect frame = labelShow.frame;
    frame.origin.x = W;
    labelShow.frame = frame;
    [UIView beginAnimations:@"testAnimation" context:NULL];
    [UIView setAnimationDuration:6.0f];
    [UIView setAnimationCurve:UIViewAnimationCurveLinear];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationRepeatAutoreverses:NO];
    [UIView setAnimationRepeatCount:9999999999];
    frame = labelShow.frame;
    frame.origin.x = -290;
    labelShow.frame = frame;
    [UIView commitAnimations];
}
复制代码

 

 

以上是关于请问跑马灯效果如何实现两行文字轮流从右向左跑? 一行跑完了,另一行再开始跑,这样循环的主要内容,如果未能解决你的问题,请参考以下文章

如何让uilabel 上的字从右向左滚动显示

CSS3设置线条延伸动画,怎么从右向左延伸

如何让uilabel 上的字从右向左滚动显示

如何让uilabel 上的字从右向左滚动显示

代码笔记iOS-字体从右向左滚动

实现input表单从右向左输入