【问题标题】:iOS8 UINavigationController push/pop with transparent UIView issue带有透明 UIView 问题的 iOS8 UINavigationController 推送/弹出
【发布时间】:2014-09-16 07:34:47
【问题描述】:

我注意到在 iOS8 中,当我在 UINavigationController 中推送新的 UIViewController 时,旧的 UIViewController 会滑出,但如果它具有非不透明背景,则在我的新顶部前景 UIViewController 中可见。

推送完成后,旧控制器就消失了,整个动画看起来很粗糙。

在 iOS8 之前,即使它是透明的,您也不会看到被推入的视图背后的视图。就好像有一个面具也滑了进来。任何人都知道解决此问题的好方法,因此它就像旧行为一样,无需使用自定义动画重新实现整个推送动画?

【问题讨论】:

  • 你有没有找到一个好的解决方案?
  • 你有没有找到一个好的解决方案?
  • 我只是通过淡入淡出视图来解决它。

标签: uinavigationcontroller transparency ios8


【解决方案1】:

这不是错误,它是 UINavigationController 的标准行为。

在推送过渡期间,UINavigationController 滑动第一个控制器比第二个慢。第二个控制器的动画完成后, UINavigationController 删除第一个视图控制器。如果第二个视图控制器具有透明背景,您会在过渡期间看到第一个控制器。

您有 3 种方法可以实现目标:

  1. 将相同的背景(不透明)添加到第二个 ViewContorller。
  2. 创建自定义过渡,如下所述:Navigation controller custom transition animation
  3. 使用 UIView 动画进行过渡。

【讨论】:

    【解决方案2】:

    这对我有用:

    ios7:

    presentingVC.modalPresentationStyle = UIModalPresentationCurrentContext;
    

    ios8:

    modalVC.modalPresentationStyle = UIModalPresentationOverCurrentContext;
    modalVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
    

    (modalVC 是你要呈现的视图)

    然后在两者中:

    [presentingVC presentViewController:modalVC animated:YES completion:nil];
    

    这里是原始来源: http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=18661

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-17
      • 1970-01-01
      相关资源
      最近更新 更多