【问题标题】:Black Screen in iOS 13 when change Storybord View Controller更改 Storybord 视图控制器时 iOS 13 中的黑屏
【发布时间】:2019-11-22 12:17:14
【问题描述】:

在 iOS 13 中,当我调用其他 StoryBoard 时,为 ViewController 充电时,我的视图上会出现黑屏。

我使用此代码调用新的 StoryBoard:

UIStoryboard *homeSB = [UIStoryboard storyboardWithName:SBNameHome bundle:nil];
UIViewController *homeVC = [homeSB instantiateInitialViewController];
homeVC.modalPresentationStyle = UIModalPresentationFullScreen;
homeVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;

[self presentViewController:homeVC animated:YES completion:nil];

这个项目使用多个 StoryBoard,当我调用一个新的 StoryBoard 时失败。如果我用 Xib 构建一个新的 ViewController,不会出现黑屏,但是该项目是用多个 StoryBoard 而不是 Xib 构建的。 我认为这是由 iOS 13 中的新 SceneDelegate 引起的。

有什么想法吗?谢谢。

【问题讨论】:

  • 你的homeVC是空的吗?我的意思是,由于暗模式和空视图控制器,您可能会遇到此问题
  • 该应用程序已完全开发并在 iOS 12 及更早版本上完美运行,但在 iOS 13 上已停止运行。

标签: ios storyboard ios13 xcode11 uiscenedelegate


【解决方案1】:

@Antonio Ureba

尝试演示风格

UIModalPresentationStyle.overFullScreen

【讨论】:

  • 第一个 StoryBoard 看起来不错,但是当转到下一个 StoryBoard 时,视图正常显示,但在我的视图中出现黑屏。
  • @AntonioUreba 你可以试试去掉过渡风格的代码homeVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
【解决方案2】:

替换

homeVC.modalPresentationStyle = UIModalPresentationFullScreen;

homeVC.modalPresentationStyle = UIModalPresentationOverFullScreen;

【讨论】:

  • 第一个 StoryBoard 看起来不错,但是当转到下一个 StoryBoard 时,视图正常显示,但在我的视图中出现黑屏。
【解决方案3】:

尝试设置背景颜色, 我也面临着黑屏,但我通过更改背景颜色来修复它

view.backgroundColor = UIColor.white

【讨论】:

  • 第一个 StoryBoard 看起来不错,但是当转到下一个 StoryBoard 时,视图正常显示,但在我的视图中出现黑屏。
  • 尝试使用 ViewControllerClassGoHere.modalPresentationStyle = .fullScreen
猜你喜欢
  • 1970-01-01
  • 2017-09-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-02-27
相关资源
最近更新 更多