I'm trying to have one of the children views in my screen (owned by one view controller) not rotate when the device rotates. My view controller allows rotations as it should, and I'm trying to apply a 90-degree rotation to the one "stationary" view to counteract the overall rotation.
Problem is, everything seems to rotate anyways, and the transform doesn't seem to do anything. I've attempted with an affine transform on the view, and with a 3d transform on the layer (below). The method is getting called, but I never see a visual difference.
Any thoughts? Thanks.
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration
{
CALayer *layer = stuckview.layer;
layer.transform = CATransform3DMakeRotation(90, 0, 0, 1);
}
Is your code actually executed? (Do you implement shouldAutorotateToInterfaceOrientation: ?)
stuckview.transform = CGAffineTransformMakeRotation(M_PI_2);
should do the job.
Note: The functions take radians not degrees.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With