KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to rotate a layer with an image at the top left corner, and not the center. According to the docs I set the anchorPoint property to [0, 1]. The view rotates in my example by 50°, but before it starts to animate, the view jumps to another point at the screen. self.shakeTag.layer.anchorPoint = CGPointMake(0.0f, 1.0f); [UIView beginAnimations:@"rotate" context:nil]; [self.shakeTag.layer setTransform: CATransform3DRotate(CATransform3DIdentity, radians(50.0), 0.0f, 0.0f, 1.0f)]; [UIView commitAnimations]; radians() is defined like this: static inline double radians (double degrees) {return degrees * M_PI/180;} When I use an image that is 4 times the size and has a lot of transparent pixels, I can rotate it at the default anchor point [0.5, 0.5], but I don’t want to waste the space for invisible pixels. Any ideas how I can prevent the layer from jumping before the rotation takes place?
Tags (comma-separated)
Save Edits
Cancel