xcode:ios8,在应用程序的单个视图上旋转

xcode:ios8,在应用程序的单个视图上旋转,ios,iphone,xcode,Ios,Iphone,Xcode,我有一个应用程序,我已经设置为仅在肖像模式下运行 但我有一个页面视图,我在其中显示一张照片,但我想使它能够与设备自动旋转。我试图把这些代码,但它不工作 -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskAll; } -(BOOL)shouldAutorotate { return YES; } 有人能告诉我现在需要做什么吗?您必须在imageview上设置旋转点 UIImage

我有一个应用程序,我已经设置为仅在肖像模式下运行

但我有一个页面视图,我在其中显示一张照片,但我想使它能够与设备自动旋转。我试图把这些代码,但它不工作

-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}

-(BOOL)shouldAutorotate {
    return YES;
}

有人能告诉我现在需要做什么吗?

您必须在imageview上设置旋转点

UIImageView *yourImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"logo.png"]];
yourImageView.center = CGPointMake(100.0, 100.0);
yourImageView.transform = CGAffineTransformMakeRotation(M_PI_2); 

但这是一个力旋转,对吗?我需要的是,当用户旋转手机时,照片会随之旋转