开发者

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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜