Mobile App Dev
Mobile App Dev

Reputation: 1814

On iPhone, How to display Animation while loading from server?

I want to implement animation like This link while application interact with server.
If someone has example to implement this kind of animation then please provide me link.

Upvotes: 0

Views: 160

Answers (2)

Chris Slowik
Chris Slowik

Reputation: 2869

interaction designer at Creativedash here =]

For something like that you'd make a png sequence, and set the animationImages property of a UIImageView. iOS is great at animating png sequences.

When your load starts, do yourLoadingImage.startAnimating() and when it's over (in the completion for your request), call yourLoadingImage.stopAnimating().

There's a property called animationDuration, and you need to set that as well, just to indicate how long the animation loop is - this doesn't indicate how long the animation will play for. It loops until you tell it to stop.

yourLoadingImage.animationDuration = 1 //set the loop duration to 1s

We actually did a short blog post on this process, and it can be the same for really any custom loader. http://news.ui8.net/create-a-custom-animated-loading-indicator-with-swift/

Upvotes: 2

TheSD
TheSD

Reputation: 883

  1. Start animation
  2. Server request in background thread
  3. End animation in completion block of server request in the main thread

If you want that specific one I think you are going to have to make it yourself, but if you don't here are some open source alternatives.

Upvotes: 2

Related Questions