PDA

View Full Version : How to animate a UIView like a curtain moving?




mikezang
Feb 3, 2011, 08:21 AM
I know how to slide a UIView using CGAffineTransformTranslate(self.transform, x, y), but I want to the UIView moving like a curtain before window, what can I do?



nickculbertson
Feb 3, 2011, 10:14 AM
check out this video http://www.youtube.com/watch?v=TasTwHPU9c8

Pay attention to the "move" button. If you want the animation without pushing a button, place the code in the viewDidLoad method.

Nick

mikezang
Feb 3, 2011, 10:45 AM
check out this video http://www.youtube.com/watch?v=TasTwHPU9c8

Pay attention to the "move" button. If you want the animation without pushing a button, place the code in the viewDidLoad method.

Nick
Thanks for you video. Little different for my requirement.
I got it with code as below:

curtain.transform = CGAffineTransformTranslate(curtai.transform, x, y);
curtain.width = 10; // curtain.width = -x;

By the way, can you tell me how to take the video:)

nickculbertson
Feb 3, 2011, 11:04 AM
Oh, that is what you meant by curtain. I thought you had a curtain image you wanted to move off the screen.

That video is not mine. "brandflakeapps" is the youtube user's name. I think he uses screenflow for his videos but I use Quicktime - Screen Recording into iMovie.

Glad you found a code that works,
Nick