0
我正在使用Cordova構建iOS應用程序。 我想我的webview是透明的,背後是用戶壁紙的模糊背景。就像ios提醒應用程序一樣。UIVisualEffects,UIWebView透明背景
我知道這是一個常見的問題,但我沒有找到指定的回覆
這可能嗎?
在我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]];
}
感謝