美文网首页
一个Label实现文字上下滚动

一个Label实现文字上下滚动

作者: 我是数据链路层 | 来源:发表于2017-04-19 15:20 被阅读0次



Label向上滚动 播放系统消息

NSArray*arr =@[@"测试一",@"测试二",@"测试三",@"测试四",@"测试五",@"测试六",@"测试七"];

_count=0;

self.label.backgroundColor= [UIColorredColor];

[NSTimerscheduledTimerWithTimeInterval:1repeats:YESblock:^(NSTimer*_Nonnulltimer) {

CATransition*tran = [CATransitionanimation];

tran.type=kCATransitionPush;

tran.subtype=kCATransitionFromTop;

[self.label.layeraddAnimation:tranforKey:@"trans"];

self.label.text= arr[_count];

if(_count== arr.count-1) {

_count=0;

}else{

_count=_count+1;

}

}];

相关文章

网友评论

      本文标题:一个Label实现文字上下滚动

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