【问题标题】:Present a blurred UIViewController on top of another UIViewController在另一个 UIViewController 之上呈现一个模糊的 UIViewController
【发布时间】:2016-04-08 13:12:39
【问题描述】:

我有 2 个 VC - firstVCsecondVCsecondVC 的视图颜色是 clear color,它有一个带有深色模糊的 UIVisualEffect 视图。

我想在firstVC 上以模态方式呈现secondVC,但是当我这样做时,firstVC 变成黑色。

谢谢

【问题讨论】:

  • 您使用的是哪个 iOS 设备?你是在 iPhone 还是 iPad 上运行?

标签: ios objective-c iphone cocoa-touch uiview


【解决方案1】:

您需要在显示的 (secondVC) 控制器上适当地设置modalPresentationStyle

UIModalPresentationOverFullScreenUIModalPresentationOverCurrentContext 将提供第二个 VC 的内容在第一个 VC 之上的效果。

【讨论】:

    【解决方案2】:

    如果 ios 版本 >= 8.0 则

     SecondViewController.modalPresentationStyle = UIModalPresentationOverCurrentContext;
    [self presentViewController:SecondViewController animated:YES completion:nil];
    

    如果使用 ios7 和导航控制器则

     self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
    [self presentViewController:SecondViewController animated:YES completion:nil];
    

    如果没有导航控制器则

     self.modalPresentationStyle = UIModalPresentationCurrentContext;
    [self presentViewController:SecondViewController animated:YES completion:nil];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多