iOS文字上下滚动效果什么实现?

iOS中一个label中文字上下滚动如何实现?
比如说下图所示的 今日头条右边的文字实现轮播。
clipboard.png

阅读 11.4k
1 个回答

[labelShow sizeToFit];
CGRect frame = labelShow.frame;
frame.origin.x = 320;
labelShow.frame = frame;

[UIView beginAnimations:@"testAnimation" context:NULL];
[UIView setAnimationDuration:8.8f];
[UIView setAnimationCurve:UIViewAnimationCurveLinear];
[UIView setAnimationDelegate:self];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationRepeatCount:999999];

frame = labelShow.frame;
frame.origin.x = -frame.size.width;
labelShow.frame = frame;
[UIView commitAnimations];

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题