My app only supports portrait orientation. But I have used AVPlayerViewController in one screen. App has UINavigationViewController and UITabBarViewController. When device is rotated to landscape mode during video play, I am having hard time to change its frame?
How can I achieve this? Where should I change frame of AVPlayerView?
NSNumber *val = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:val forKey:@"orientation"];
Or ask the visible View Controller :
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return self.CurrentViewController.preferredInterfaceOrientationForPresentation;
}
- (BOOL)shouldAutorotate {
return self.CurrentViewController.shouldAutorotate;
}
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.