Search code examples
c#iosuiwebviewxamarin.iosuiwebviewdelegate

Possible to have html button in UIWebView content load new ViewController?


I am developing a mono touch app and need to have a UIWebView take up the entire screen (no navigation controller showing), but have a button on the WebView content be able to load a new ViewController to do barcode scanning. I am not quite sure how to pull this off with the button being in the actual HTML content and not on the native side. Is this even possible?


Solution

  • Is this even possible?

    Should be since it sounds similar to: response UIWebView click action to call up native code page

    Except that you'll be using MonoTouch / C# instead of Objective-C. You can convert the code easily using UIWebViewDelegate or (better) use the, more .NET-ish, UIWebView.ShouldStartLoad.

    There's an example of the later in the answer to: ShouldStartLoad of custom UIWebViewDelegate not being called when UIWebView request starts loading