真ん中に UIImageView がある UIView を想像してみてください。iPhone を回転させても画像が上に表示されます。つまり、iPhone を右に回転させると、UIImageView は同じ角度で左に回転します。このオプションを使用する iAngle Meter などのアプリを見たことがありますが、どうすればよいですか?
PD.画像を回転する方法しか知らないので、次を使用します。
#define M_PI 3.14159265358979323846264338327950288 //pi
#define DEGREES_TO_RADIANS(angle) (angle / 180.0 * M_PI)
- (void)rotateImage: (UIImageView *)image duration:(NSTimeInterval)duration curve:(int)curve degrees:(CGFloat)degrees {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
[UIView setAnimationCurve:curve];
[UIView setAnimationBeginsFromCurrentState:YES];
CGAffineTransform transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(degrees));
image.transform = transform;
[UIView commitAnimations];
}
申請行:
[self rotateImage:logoAnim duration:0.5 curve:UIViewAnimationCurveEaseIn degrees:-30];
ありがとう、