iPhone keeps elements in layer basis and you can handle any layer using CALayer class. You can rotate an object of a layer wrt other layer.

Here is a link that helps you to understand the layer geometry: https://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/Layers.html

Every object has 2 points and 2 frames in a layer.

The points are: 1. position and 2. anchorPoint

1. position: position means the coordinate of rotation/weight point wrt system coordinate.

2. anchorPoint: The distance of rotation/weight point from x bound and y bound.

The frames are: 1. bounds  and  2. frame

1. bounds: The coordinate of each object wrt to that object(0.0,0.0,width,height)

2. frame: The coordinate of each object wrt to system coordinate(x,y,width,height)

Formula to set rotation point:

if rotation point is (X,Y) and anchorPoint=(A,B)

Then,

X = x + width*A

Y = y + height*B

using this eqn. you can calculate any value that you require.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s