【问题标题】:Master ViewController becomes blank after rotation主视图控制器旋转后变为空白
【发布时间】:2015-12-20 10:52:42
【问题描述】:

我通过

制作MGSplitViewController

MySplitViewController = [[MGSplitViewController alloc] init]; [MySplitViewController setViewControllers:@[masterVC, detailVC]];

在 iPad 上从纵向旋转到横向后,masterVC 显示为空白。在视图层次结构中,我看到它只是背景窗口,上面没有 masterVC。 DetailVC 正确呈现。

请帮帮我。

【问题讨论】:

    标签: ios objective-c ipad uiviewcontroller uisplitviewcontroller


    【解决方案1】:

    当您的 ipad 处于纵向模式时,您的主屏幕会弹出一个窗口。 什么意味着您正在使用此弹出窗口作为presentingViewController来呈现模式,因此当您从纵向移动到横向时,方法 splitViewController:willShowViewController 将使您的弹出窗口为零,如您所见:

    - (void)splitViewController:(UISplitViewController )splitController willShowViewController:(UIViewController )viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem
        {
            // Called when the view is shown again in the split view, invalidating the button and popover controller.
            [self.navigationItem setLeftBarButtonItem:nil animated:YES];
            self.masterPopoverController = nil;
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-25
      • 2013-03-22
      相关资源
      最近更新 更多