我面臨同樣的問題。您應該在您的應用程序委託類中實現此方法。這裏是example.Hope這是你需要的。
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(nullable UIWindow *)window
{
if([window.rootViewController isKindOfClass:[HRMHomeViewController class]])
{
id homeViewController = (HRMHomeViewController*)window.rootViewController;
if ([[homeViewController presentedViewController]
isKindOfClass:[HRMCapturedScreenViewController class]])
return UIInterfaceOrientationMaskPortrait;
}
return UIInterfaceOrientationMaskAll;
}
你的相機層的這個方法幀會根據方向旋轉
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration
{
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation
duration:duration];
self.captureManager.cameraLayer.frame = self.videoView.bounds;
}
有在UINavigationController
方法從而可以help.Here是雙向或使UINavigationController
類別或繼承它。
- (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController
- (UIInterfaceOrientation)navigationControllerPreferredInterfaceOrientationForPresentation:(UINavigationController *)navigationController