想象一下UIView在中间有一个UIImageView,当我旋转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];
谢谢,
答案 0 :(得分:0)
查看UIViewController的方法:
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation
duration:(NSTimeInterval)duration {
}
它将通过info.plist和-shouldRotateToInterfaceOrientation:方法通知您何时开始旋转到您已启用到应用程序的方向。