Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Transparent WebView in iOS

$
0
0

@iarry wrote:

I'm using this cordova plugin which adds a view to the VC's view. It works as expected when the new view is on top of the WebView, but I need it to be under the WebView so I can add an overlay that's part of the WebView.

The plugin does everything you normally would need to do in order to see a view beneath the other. Here's the snippet:

self.webView.opaque = NO;
self.webView.backgroundColor = [UIColor clearColor];

[self.viewController.view insertSubview:self.cameraRenderController.view atIndex:0];

For reference, here's how it's adding the view when it's on top of the WebView:

self.cameraRenderController.view.alpha = (CGFloat)[command.arguments[8] floatValue];

[self.viewController.view addSubview:self.cameraRenderController.view];

Adding the first line to first snippet didn't work. In fact, if I do self.webView.alpha = 0.1f I can see the view underneath at full alpha, however that's not what I'm looking for because I need other parts of the WebView to be visible.

In my CSS I've tried anything that I can see under a browser inspector, and checked Ionic's CSS for any background-color for .platform-ios rules. Here's the list of classes and directives I've tried:

body, html, ion-pane, ion-content, ion-view, ion-nav-view, .scroll, .platform-ios, .view, .platform-ios{
    background-color: transparent !important;
}

Some things I've tried:

  1. Making all subviews of the WebView transparent.
  2. Making all subviews of the VC view transparent.
  3. Using [self.webview setOpaque:NO] and [self.webview setBackgroundColor:[UIColor clearColor]]
  4. Adding self.webView to the VC view again after adding the first view.
  5. Changing the alpha of the WebView (you can see the view under it, but this isn't a solution to making the WebView transparent).
  6. Setting html{display:none !important;} will still display a white page.

If it matters at all ion-pane is the only thing that needed changed for Android's WebView to stop blocking the view being added. I'm not sure if it's something in the plugin or how Ionic builds its iOS WebView / any other views that might be added at some point.

Any help would be appreciated, thanks!

E: Adding things to the list of things I've tried.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>