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;
}
}];
网友评论