I'm trying to change a anchor point to (0,0) (it's not center.) of uibutton and rotate.
How to change a anchor point of uibutton?
mybutton.anchorPoint? = CGPointMake(0, 0); <= How to change?
[UIView animateWithDuration:5.0 animations:^{
mybutton.transform = CGAffineTransformMakeRotation(180 * M_PI / 180);
}];
Each CALayer
has an anchorPoint
property. You can do one of the following:
EDIT:
Example: [button.layer setAffineTransform:CGAffineTransformMakeRotation(180 * M_PI / 180)]
I think you would set it by the following
[button.layer setAnchorPoint:CGPointMake(button.frame.origin.x, button.frame.origin.y)];
But I'm only just playing with it myself. So not positive if it will work yet.
A
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.