tags:

views:

65

answers:

2

i want to rotate image in quartz 2d around one corner..i want to make analog clock.

A: 

You should probably start with the Quartz 2D Programming Guide. In particular, check out the section on transforms, this covers rotation.

Essentially what you need to do is apply a transform matrix for rotation to the Current Transform Matrix (CTM). This defines the mapping of the coordinates that you draw to and the coordinates that are displayed on the user's device.

Quartz does make this all fairly straightforward to do in code; the link above has example code.

Greg Sexton
thanks...but can i rotate image with having one end stable and other end rotating around it..like hands of clock...can you give me a example....?
Kuldeep Sidhu
A simple rotation transform rotates around the origin (the lower-left). You could translate the origin to the center (presumably) then perform the rotation. Now draw your clock hand into this. Your clock hand will need to be drawn so that the point to rotate about is in the lower left corner of the window.
Greg Sexton
A: 

For example, you could do something like :

CGAffineTransform transform = CGAffineTransformMakeRotation(ANGLE_IN_RADIANS);
view.transform = transform;

And if you want a smoother animation, try using an UIView Animation.

But if you need an other rotation, you should check the documentation :-)

Good Luck !

Vinzius