views:

164

answers:

1

I have an UIImageView which I want to rotate a little bit, but I need to define an special origin for rotation. How could I do that? More precisely, I have an image of a goblet, and I want it to wiggle on a table. It's socket is quadrate. So when wiggeling to left, then my rotation origin has to be the left corner of that quadrate. And when wiggeling to right, the rotation origin has to be the right corner of that quadrate.

How could I do that? I already have this:

myView.transform = CGAffineTransformMakeRotation(.25);

+1  A: 

There was a similar question on how to achieve this here.

The best answer was to change the anchorPoint property of the underlying layer of the UIView.

pgb