在ios中关闭模型视图控制器后,父视图不保持其方向

时间:2013-11-21 10:10:09

标签: ios uinavigationcontroller uiinterfaceorientation

我正在开发iphone应用程序。因为所有viewcon enter code here都支持所有方向。但是我的一个navigationController堆栈内容想要呈现一个 仅在viewcontroller Landscapeorientation。我通过使用rootviewcontroller创建一个定义UINavigationController作为我的modelviewcontroller来完成此操作,它仅支持横向模式,并且当纵向modd中的parentviewcontroller时它工作正常,但是横向中的parentviewcontroller它将模型视图控制器呈现为景观正常但在解除之后modelViewcontroller parentviewcontroller为纵向,但self.viewsubview处于横向状态。  请帮帮我..我把我的代码和截图如下所示..

自定义navigationcontroller中的

.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];

0 个答案:

没有答案