Core Animation Rotating A Layer Around Arbitrary Point
How can I rotate a layer using Core Animation around an arbitrary point? ( In my case a point that is not inside the layer I want to rotate )
I prefer doing this without changing the anchor point, because unless I get something wrong every time I change the anchor point it also changes the position of the layer.
I tried something like that but it didn't work:
[UIImageView beginAnimations:nil context:nil]; CATransform3D rotationTransform = CATransform3DIdentity; rotationTransform = CATransform3DTranslate(rotationTransform, 0.0, -100.0, 0.0); rotationTransform = CATransform3DRotate(rotationTransform, DegreesToRadians(180), 0.0, 0.0, 1.0); rotationTransform = CATransform3DTranslate(rotationTransform, 0.0, 100.0, 0.0) shape1.layer.transform = rotationTransform; [UIImageView commitAnimations];
It looks like the rotation axis is moving during the rotate.
I finaly did it by creating a new bigger layer with it's center at my rotation axis and setting the layer i want to rotate as it's sub layer.
Then I rotate the bigger layer instead of the sub layer
- → Web App Image Rotate Issue
- → Website not loading on AT&T LTE; all other carriers and wifi work fine
- → Disable wheel selector on iOS Safari?
- → React router & Phonegap - First page not found
- → unable to add photo from iphone to canvas
- → What's the best practice for having a Laravel application serve both the browser-based application, and act as an API for the iPhone and Android app?
- → Wordpress mobile nav menu: menu appears on click on iPhone and other mobile devices, but not iPad
- → How to save the response From My server , and How can i access That data
- → Communication between iPhone app and AWS server
- → NSDateFormatterStyle.MediumStyle doesn't show in iPhone
- → Could not find Developer Disk Image - Xcode 7.2 & iOS 9.2
- → String encryption in Objective-C decrypt in C#