Way off topic… but I figure this is the best bunch of people from which to get a timely and accurate answer ( :slight_smile: )

this is obvious XCODE

[myCTRL setFrame:CGRectMake(90.0,180.0,200.0,33.0)];
myCTRL.transform = CGAffineTransformRotate(myCTRL.transform, M_PI/2);
myCTRL.transform = CGAffineTransformTranslate(myCTRL.transform,999,999);

First line sets the metrics for a Control [X,Y, W, H) in it standard horizontal configuration
Second line rotates that control by 90 degrees around its own center point which now obviously moves the corner points
The intent of the 3rd line is to move the control so the new upper left corner is the same exact place the original X,Y were

But I cannot seem to figure out how to calculate what values should replace the "999"s in the example above
unless I am using totally the wrong method here (FYI… it DOES the rotation… just doesn’t put it where I want)

If you have an answer it does not have to be expressed in XCODE (unless required)

Are you sure that…

myCTRL.transform = CGAffineTransformRotate(myCTRL.transform, M_PI/2);

rotates around the centre of the object.

I have used the Cocoa equivalents such as

[sizeTransform rotateByDegrees: -rotateDegrees];

and this rotates the point of origin.

The point of origin in Cocoa (0,0) is the bottom left hand corner.

I have some Cocoa code I used to rotate an image for SuperCard which I could post if you require.

All the best


All my tests show it rotating around the center… but web docs seems to indicate it is around upper left (X,Y)

But I finally did find the answer via tons of trial and error

DX=(H-W)/2; // how simple is that... I was chasing SIN/COS all night :)
myCTRL.transform = CGAffineTransformTranslate(myCTRL.transform,DX,DX);


Not really doubting you but…

Having just refreshed myself the book Programming with Quartz clearly states that by default the origin is in the lower left hand corner.

Good luck