rossbaker
12-05-2006, 09:40 AM
Hi
I've been battling with the old "rotating a view about the center" issue (see various other threads).
The point around which a view is rotated is called the "Registration Point" (RP), which is specified by setting the {xoffset,yoffset} attributes of the view. The default RP is {0,0} which is the upper left-hand corner of the view.
To rotate around a different point, say the center point of the view, you have 2 options:
1) use the "trick" of placing the view inside an invisible container view, and rotating the container view (see full description in other threads);
2) move the RP (ie the xoffset/yoffset).
Moving the RP is fine for the rotation, it works. BUT ...
the RP also affects the placement of the view within it's parent view's coordinate space (parent could be another view or the canvas for example). So, when you change the RP to make your rotation work, you also end up changing the view's location.
Anyway, my real question at this stage, since I'm in the middle of learning all about this stuff, is what is the Registration Point (ie the xoffset and yoffset) for? If you want to MOVE the view, why not just change the x/y values of the view?? Is there a scenario where you'd want to leave the x/y values alone, but use the offsets to move the view?
I can't seem to find any information on the real purpose of these offsets.
Any insight would be greatly appreciated.
Cheers
Ross :)
I've been battling with the old "rotating a view about the center" issue (see various other threads).
The point around which a view is rotated is called the "Registration Point" (RP), which is specified by setting the {xoffset,yoffset} attributes of the view. The default RP is {0,0} which is the upper left-hand corner of the view.
To rotate around a different point, say the center point of the view, you have 2 options:
1) use the "trick" of placing the view inside an invisible container view, and rotating the container view (see full description in other threads);
2) move the RP (ie the xoffset/yoffset).
Moving the RP is fine for the rotation, it works. BUT ...
the RP also affects the placement of the view within it's parent view's coordinate space (parent could be another view or the canvas for example). So, when you change the RP to make your rotation work, you also end up changing the view's location.
Anyway, my real question at this stage, since I'm in the middle of learning all about this stuff, is what is the Registration Point (ie the xoffset and yoffset) for? If you want to MOVE the view, why not just change the x/y values of the view?? Is there a scenario where you'd want to leave the x/y values alone, but use the offsets to move the view?
I can't seem to find any information on the real purpose of these offsets.
Any insight would be greatly appreciated.
Cheers
Ross :)