我正在开发iphone应用程序 . 在那所有viewcon enter code here
troller支持所有方向 . 但我的一个 navigationController
堆栈内容只想在 Landscape
orientation
中显示一个 viewcontroller
. 我通过使用rootviewcontroller创建一个定义UINavigationController作为我的 modelviewcontroller
来完成此操作,它仅支持横向模式,并且当纵向modd中的parentviewcontroller时它工作正常,但是横向中的parentviewcontroller它将模型视图控制器呈现为景观正常但在解除 modelViewcontroller
之后 parentviewcontroller
为肖像,但 self.view
和 subview
在景观中 . 请帮帮我..我把我的代码和截图如下..
.m file in custom navigationcontroller I done this..
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return NO;
}
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL) automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers {
return YES;
}
-(BOOL)shouldAutorotate
{
return YES;
}
.m file 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];