2013-07-02 45 views
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]; 
} 

不幸的是這個代碼不工作。所有我在結果是:

enter image description here

回答

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]; 
    } 
} 
0

mgsplitviewcontroller具有必要的功能,爲您

- (IBAction)toggleMasterView:(id)sender; // toggles display of the master view in the current orientation. 
+0

這是無用的因爲我的應用程序中有特殊的UI要求。 :( –

相關問題