我有一个拆分视图,它有主控和详细导航控制器。 我希望我的细节VC能够以全屏模式呈现其内容。
这就是我所拥有的:
-(void) tapFullscreenBtn{
UIWindow *mainWindow = [[UIApplication sharedApplication] keyWindow];
UIWindow *topWindow = [[UIWindow alloc] initWithFrame: mainWindow.bounds];
topWindow.backgroundColor = [UIColor purpleColor];
topWindow.windowLevel = UIWindowLevelStatusBar + 1.0f;
self.view.frame = mainWindow.bounds;
self.navigationController.view.frame = mainWindow.bounds;
[topWindow addSubview:self.navigationController.view];
[topWindow makeKeyAndVisible];
[self.navigationController.view setNeedsLayout];
[self.view setNeedsLayout];
}
不幸的是,这段代码不起作用。我得到的结果是:
答案 0 :(得分:0)
mgsplitviewcontroller为您提供必要的功能
- (IBAction)toggleMasterView:(id)sender; // toggles display of the master view in the current orientation.
答案 1 :(得分:0)
好的我用这个解决了这个问题:
-(void) tapFullscreen {
if(!_isFullscreenMode)
{
MySplitDetailViewController *fullscreenVC = [[MySplitDetailViewController alloc] init];
fullscreenVC.isFullscreen = YES;
UINavigationController* fullscreenNavVC = [[UINavigationController alloc] initWithRootViewController:fullscreenVC];
[self.navigationController presentViewController:fullscreenNavVC animated:YES completion:nil];
}
else
{
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
}