我正在开发iphone应用程序。因为所有viewcon enter code here
都支持所有方向。但是我的一个navigationController
堆栈内容想要呈现一个
仅在viewcontroller
Landscape
中orientation
。我通过使用rootviewcontroller创建一个定义UINavigationController作为我的modelviewcontroller
来完成此操作,它仅支持横向模式,并且当纵向modd中的parentviewcontroller时它工作正常,但是横向中的parentviewcontroller它将模型视图控制器呈现为景观正常但在解除之后modelViewcontroller
parentviewcontroller
为纵向,但self.view
和subview
处于横向状态。
请帮帮我..我把我的代码和截图如下所示..
.m文件我做到了这一点..
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL) automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers {
return YES;
}
-(BOOL)shouldAutorotate
{
return YES;
}
.m文件parentView
//这是我的presentViewcintroller代码
VideoPreviewViewController *videoPreviewVC = [[VideoPreviewViewController alloc]initWithNibName:@"VideoPreviewViewController" bundle:nil];
customNavigationController = [[CLNotRotatingNavController alloc]initWithRootViewController:videoPreviewVC];
[self.navigationController presentViewController:customNavigationController animated:YES completion:nil];
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;
}
modelviewcontroller中的.m文件
[self.navigationController dismissViewControllerAnimated:YES completion:nil];