2

I'm using the InAppBrowser plugin with Cordova 3.0 but can't get the background color of the UIWebView to be transparent so I can see my app in the background. Most of the time people say some version of the following should handle what I'm trying to do:

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

But it's not working for me. No matter what I try the background behind my InAppBrowser view is black (i.e. I can't see my app in the background).

Can anyone help? Is there perhaps some code in the InAppBrowser plugin that is overriding the above code? I've cloned the plugin for now so you can see what I've tried: http://goo.gl/fsSXUC

Thanks in advance for any help/advice!

Update1

Using the presentationstyle=formsheet actually does accomplish the transparency I need but I need to control the UIWebView dimensions so I need to get a lower-level/core solution figured out.

Update2

Looks like I'm falling into a question that's been asked in different ways around StackOverflow (like: UIModalPresentationCurrentContext with Transition?). Guess I won't hold my breath for an answer here but please chime in if someone has a clean/simple solution here!

Community
  • 1
  • 1
Christopher
  • 1,639
  • 19
  • 22

1 Answers1

2

Answering my own question here.

For anyone interested, I finally finished (knock on wood) modifying the latest version of InAppBrowser to do what I was looking for here. The modified, totally unsupported, version can be found here from now on: https://github.com/cemerson/cordova-inappbrowser-ce

Main thing I added to this plugin is the ability to specify the Width, Height, xOffset and yOffset of the InAppBrowser UIWebView (iOS only) - thereby (re)achieving the transparency I was looking for above.

Please note I am not a professional ObjectiveC programmer by any stretch but in short, to achieve the above modifications to InAppBrowser I changed the code so that it now uses [addsubview] instead of [presentmodalviewcontroller] most of the time - since the latter prevents any kind of transparency unless you're using formsheet presentation style.

Hope this helps someone else! Please chime in on the github page if anyone has advice/tips/suggestions for the modified version I've made.

Christopher
  • 1,639
  • 19
  • 22
  • Very nice. I am implementing this right now because I need my webview to have y-position. Any chance you add this to the Android version aswell? – nizzle Oct 06 '13 at 12:21
  • Sorry - no Android version of this yet as I have zero skills with java. My fear is that the way webviews work in Android vs iOS may turn out to be quite different so that it may not even be possible to pull transparency off. I would love the ability/flexibility though myself if/when Android interest increases on my end so I'll chime in here again if I have any updates/news here. – Christopher Oct 07 '13 at 02:09