你能解释我如何旋转图像使用锚点,如
https://www.dropbox.com/s/vh3h5cr1mkdbfh3/ex_image2.JPG
on .m
#import <QuartzCore/QuartzCore.h>
on .h
[UIView animateWithDuration:0.7f
delay:0
options:UIViewAnimationOptionCurveEaseOut
animations:^
{
self.center = position;
self.layer.anchorPoint = CGPointMake(-1, 0);
self.transform = CGAffineTransformMakeRotation(-5);
}
completion:^(BOOL completed){
}];
当我使用这段代码时,我有类似的东西
答案 0 :(得分:0)
将旋转变换应用于图层时,旋转会在定位点周围发生。
首先将图层的锚点设置为(0.0,0.0)。
self.layer.anchorPoint = CGPointMake(0.0f, 0.0f);
然后你可以旋转视图,旋转将发生在锚点周围,(0.0,0.0)。
[UIView animateWithDuration:2.0f animations:^{
self.transform = CGAffineTransformMakeRotation(3.1415f);
}];
代码将以您拍摄的方式一次旋转视图。