简体   繁体   中英

xcode: ios8, rotate on single view of the app

I have an app that I have set to only run on portrait mode only.

But I have a page view where I am showing a photo but wants to enable it to auto rotate with the device. I tried to put these codes but its not working

-(NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}

-(BOOL)shouldAutorotate {
    return YES;
}

Can someone please advise what's needed to do now?

You have to set the point of rotation on your imageview

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM