Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone: Scale UIView about a specific point

I want to animate the scaling down of a UIView, but not about its center: about a different point.

As a shot in the dark, I tried translating the view, scaling, then translating back, using a series of CGAffineTransforms. But it doesn't work: it still scales about the center.

Anyone know how to do this?

Thanks very much.

like image 712
Greg Maletic Avatar asked May 29 '10 01:05

Greg Maletic


1 Answers

Add the Quartz framework to your project and import the Quartz header

#import <QuartzCore/QuartzCore.h>

You can then set the anchor point of your view (around which animations are based) e.g.

myView.layer.anchorPoint = CGPointMake(0, 0);

Note that the points are values between 0 and 1, with 0,0 being top left on the iPhone

like image 102
RunLoop Avatar answered Nov 02 '22 19:11

RunLoop