How to use UIBlurEffect with modal View Controllers?

后端 未结 6 2297
夕颜
夕颜 2021-02-13 14:17

I have a UIViewController that presents another UIViewController modally. I want the modal view controller to have the blur/transparency that iOS 7 int

6条回答
  •  执笔经年
    2021-02-13 15:07

    the easiest way is just copy and paste this code in viewDidLoad :)

    UIVisualEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
    UIVisualEffectView *visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
    
    visualEffectView.frame = self.view.bounds;
    self.view insertSubview:visualEffectView atIndex:0];
    

提交回复
热议问题