tags:

views:

39

answers:

1

Hi,

I'm planning to create a game like hangman. And I want every character appear from the top, like flying from the top. Do I have to make a transition or just hard code the animation for this implementation?

Thanks.

+2  A: 

Put each character in its own UIView instance and animate the center property.

//let's say we have a custom UIView subclass that displays a character called 'MYCharacterView'

MYCharacterView * view = [[MYCharacterView alloc] initWithFrame:CGRectMake(50.0, -10.0, 20.0, 20.0);
// ... configure the view here, e.g., set the character, etc. ...
[UIView beginAnimations:nil context:nil];
//animate the view from its current position off the top of the screen to 50, 200
//over 2 seconds
[view setCenter:CGPointMake(50.0, 200.0)]; 
[UIView setAnimationDuration: 2.0];
[UIView commitAnimations];

Hope that helps!

Art Gillespie