开发者

Scrolling text with wrapping on iPhone

开发者 https://www.devze.com 2023-01-13 00:41 出处:网络
is it possible to make text scroll horizontally and wrap when finished? Automatically scrolling like a NYSE ticker.

is it possible to make text scroll horizontally and wrap when finished? Automatically scrolling like a NYSE ticker.

And is there a method that could get called on the re-wrap, so I could, for example, refresh the news feed?

I heard you can do this in Three20 bu开发者_运维问答t I'm not sure of the class / implementation.

Cheers!


I recently created one of these. Basically I used 3 UILabels and get positioned in the layoutSublayers method of a CALayer that gets layed out every blank amount of seconds. When one goes off screen it moves to the end. Some key points to remember:

Use CADisplayLink as the timer instead of an NSTimer.

If you want the user to be able to scroll as well you will need to put in some logic to switch directions based on which way you're going. I use a UIPanGestureRecognizer to detect this.

Hope this helps

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号