Get Updates By E-mail 

Article Written By:
Johann Dowa

Animating A Game Sprite In Cocoa Touch

  •  
  •  
  •  
  •  
  •  

Something that can be very easily done using Cocoa Touch is animation.  This is a brief programming tutorial showing how it’s done.

The easiest way to do animation in Cocoa Touch is using the animationImages property from a view.
It’s a simple 3 step process.

1. Set animation images to an array containing your UIImages to be used for animating.
2. Set the duration to animate for.  (you can also set the number of times to repeat the animation for.)
3. Start the animation.

For example:

UIImageViewName.animationImages = arrayContainingImages
UiImageViewName.animationDuration = .. number of seconds ..
[UiImageViewName startAnimating]

More information on animationImages can be found in Apple’s UIImageView Class Reference here.

Brandon has posted a nice project here at: Animating A Game Sprite

[Via: iCodeBlog]


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments