【发布时间】:2017-03-08 12:11:43
【问题描述】:
我正在使用 Cordova 构建 iOS 应用程序。 我希望我的 webview 是透明的,并且在它后面是用户壁纸的模糊背景。喜欢 ios 提醒应用。
我知道这是一个常见问题,但我没有找到具体的回复
有可能吗?
在我的 viewDidLoad 方法中,我添加了以下几行:
- (void)viewDidLoad
{
[super viewDidLoad];
self.view.backgroundColor = [UIColor clearColor];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
UIVisualEffectView *blurEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
blurEffectView.frame = self.view.bounds;
blurEffectView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
//This line places a dark black background with my app being blurred behind it
[self.view addSubview:blurEffectView];
//This line instead just makes background of app plain black (the body of html app is transparent) and not blurred , I guess there is something wrong with view hierarchy maybe?
[self.view addSubview:self.webView];
[self.webView setOpaque:NO];
[self.webView setBackgroundColor:[UIColor clearColor]];
}
提前致谢
【问题讨论】:
标签: ios cordova uiwebview uivisualeffectview