我试图在另一个 View Controller 上呈现一个 View Controller ,其中上部将是透明的,而底部将具有这种模糊效果。
发生的情况是,我在呈现的 View 中看到黑色背景,尽管其颜色清晰。
我也读过这里,并且做了完全相同的事情: Display clearColor UIViewController over UIViewController
//to present
PillView *pillv=[[PillView alloc]initWithPill:pill WithNum:num];
pillv.delegate=self;
UIVisualEffect *blurEffect;
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *visualEffectView;
visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
visualEffectView.frame=CGRectMake(0, 0, self.view.frame.size.width, [Globals sharedGlobals].titleHeight*self.view.frame.size.height);
[self.view addSubview:visualEffectView];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:pillv animated:NO completion:nil];
最佳答案
从 Ios 8 及更高版本开始,请使用 UIModalPresentationOverCurrentContext 而不是 UIModalPresentationCurrentContext
关于ios - 在另一个 View Controller 上呈现透明 View Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33281273/