dbalman Member Licensed User Longtime User Oct 18, 2016 #1 My purpose is to achieve a page darkening effect with a black panel behind the WKWebView. This is what I've come up with: B4X: #IF OBJC - (void )setTransparent: (UIWebView*)WKWebView { [WKWebView setBackgroundColor:[UIColor clearColor]]; [WKWebView setOpaque:NO]; } - (void )setOpaque: (UIWebView*)WKWebView { [WKWebView setBackgroundColor:[UIColor whiteColor]]; [WKWebView setOpaque:YES]; } - (void )setAlpha: (UIWebView*)WKWebView { [WKWebView setBackgroundColor:[UIColor colorWithRed:0.0f/255.0f green:0.0f/255.0f blue:0.0f/255.0f alpha:0.8f]]; [WKWebView setOpaque:NO]; } #END IF The first two methods work as expected, but the setAlpha method is not. What am I doing wrong? Is there a better way to access the WKWebView's alpha level property?
My purpose is to achieve a page darkening effect with a black panel behind the WKWebView. This is what I've come up with: B4X: #IF OBJC - (void )setTransparent: (UIWebView*)WKWebView { [WKWebView setBackgroundColor:[UIColor clearColor]]; [WKWebView setOpaque:NO]; } - (void )setOpaque: (UIWebView*)WKWebView { [WKWebView setBackgroundColor:[UIColor whiteColor]]; [WKWebView setOpaque:YES]; } - (void )setAlpha: (UIWebView*)WKWebView { [WKWebView setBackgroundColor:[UIColor colorWithRed:0.0f/255.0f green:0.0f/255.0f blue:0.0f/255.0f alpha:0.8f]]; [WKWebView setOpaque:NO]; } #END IF The first two methods work as expected, but the setAlpha method is not. What am I doing wrong? Is there a better way to access the WKWebView's alpha level property?
Erel B4X founder Staff member Licensed User Longtime User Oct 18, 2016 #2 You can change the alpha level with: B4X: WKWebView1.BaseView.Alpha = 0.5 Upvote 0