I have a UILabel on the screen, which is currently in portrait. However, I have a 3D scene rendered in the previous layer, which is presented landscape regardless. How would I be able to set the point of the label at 0,0; and have it be visible at 0,0; as if it was in landscape. I figure it would need to be rotated 90 degrees, and then have the axis inverted.
I’ve written some code, but it doesn’t work as I had hoped.
control.transform = CGAffineTransformRotate(CGAffineTransformIdentity, M_PI/2);
CGRect newFrame = CGRectMake(oldFrame.origin.x, oldFrame.origin.y, control.frame.size.width, control.frame.size.height);
newFrame.origin.y = 320 - (newFrame.origin.y - control.frame.size.width);
//invert the x and y axis
CGFloat x1 = newFrame.origin.y;
CGFloat y1 = newFrame.origin.x;
CGFloat w1 = newFrame.size.width;
CGFloat h1 = newFrame.size.height;
control.frame = CGRectMake(x1, y1, w1, h1);
I’m really confused about this!
Any help appreciated.
You should try not to mix portrait and landscape.
Try using a UIViewController that only allows landscape; positioning the label would be much easier.