简体   繁体   中英

Swift: make ellipsis continually retype in label? Tough label “animation”?

I have seen no other questions on this concept - Im working in Swift and am doing a sort of loading page where I have a label that says something while the thing loads, similar to Sims. Like: "Checking our sources..."

As a cool animation, I want to have the ellipsis continually "reload" or "retype" so the label goes:

"Checking our sources." -> "Checking our sources.." -> "Checking our sources..." and back again.

I have no idea how to do this and not sure if it qualifies as an animation. How can I constantly alter the text in a label to "animate" my ellipsis? I really would like to do this - is it possible?

I have no idea how to do this and not sure if it qualifies as an animation. How can I constantly alter the text in a label to "animate" my ellipsis? I really would like to do this - is it possible?

All you are really describing is a label whose text is modified every so often. Or it doesn't have to be a label; it could just be a view that draws text, and you are redrawing the text every so often. You could easily implement a repeating timer (NSTimer) to do this, or you could use a custom animatable property and let the animation engine do the timing for you.

Took me about a minute to throw this together using an NSTimer, so how hard can it be?

在此处输入图片说明

If you like, you can use alternative "ellipsis" characters, or even images:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM