Sabby
Sabby

Reputation: 2592

Image with animation in iphone

I want to use the image in view which will move like marquee as in HTML,from one end to another end of view. Could anyone provide me with that code how to do that.

Thanks in advance n please help me out with this.

Upvotes: 0

Views: 426

Answers (2)

Ajith
Ajith

Reputation: 1457

It was the new Blocks API which introduced in iOs 4.0 Use this if you are not yet in 4.0

 CABasicAnimation *theAnimation;        
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.translation.x"];
theAnimation.duration=1;
theAnimation.repeatCount=2;
theAnimation.autoreverses=YES;
theAnimation.fromValue=[NSNumber numberWithFloat:0];
theAnimation.toValue=[NSNumber numberWithFloat:-60];
[view.layer addAnimation:theAnimation forKey:@"animateLayer"];

This bit of code moves the view 60 pixels to the left then back to its original position [please dont forget to vote if you find this answer useful :-) ]

Upvotes: 1

Ajith
Ajith

Reputation: 1457

Use uiview's transition effects..

[UIView AnimateWithDuration: delay: options: animations: completion: ];

methode. repeat transition with some nice effects.

Upvotes: 0

Related Questions