i want to perform Scaling and Translation of image together so how its possible?
A:
Just make the new opposite corners of your image the two detected multitouch points. You have to keep either the rotation or the aspect ratio fixed, of course. (In theory, you could mess with the aspect ratio rather than the rotation, but you probably want the rotation to change, not the aspect ratio).
i.e. Override the touchesBegan and touchesMoved to save the initial points (in the began) and calculate rotation, translation and zoom (in the Moved), and construct a CGAffineTransform to apply to the imageView.
whybird
2010-02-24 05:56:57
Actually i have a one image of car and i want when i travel from one point to another point the size should be changed(Increases).
Ankit Vyas
2010-02-24 06:10:58
I have tried this please check it is there any mistake done by meit directly shows zoomed image and then travel but i want both.[UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:5.0]; carImg.transform = CGAffineTransformTranslate(CGAffineTransformIdentity, 20, 20.0); carImg.transform = CGAffineTransformScale(carImg.transform, 1.5, 1.5); carImg.transform = CGAffineTransformTranslate(carImg.transform, 50, 50); carImg.transform = CGAffineTransformScale(carImg.transform, 2.5, 2.5); carImg.transform = CGAffineTransformTranslate(carImg.transform, 50, 50);
Ankit Vyas
2010-02-24 06:24:38
You need to just set the carImg.transform once per animation that you want - so either store the intermediate steps of the transform in a temporary variable as you build up the final transform, or combine each pair of lines into one - e.g. carImg.transform = CGAffineTransformTranslate(CGAffineTransformScale(carImg.transform, 2.5, 2.5), 50, 50);
whybird
2010-02-24 22:56:34