0

我有一个拆分视图,其中包含主导航控制器和详细导航控制器。我希望我的细节 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];
}

不幸的是,这段代码不起作用。我得到的结果是:

在此处输入图像描述

4

2 回答 2

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];
    }
}
于 2013-10-08T11:08:05.267 回答
0

mgsplitviewcontroller为您提供必要的功能

- (IBAction)toggleMasterView:(id)sender; // toggles display of the master view in the current orientation.
于 2013-07-02T14:09:29.907 回答