Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 75885

Proper way to create renderer for WebView in iOS

$
0
0

I am using below code for WebViewRenderer in iOS

public class WebViewPageRenderer : WebViewRenderer
{
    protected override void OnElementChanged(VisualElementChangedEventArgs e)
    {
        base.OnElementChanged(e);
    //creating new webview object to load url
        UIWebView webView = new UIWebView() { Delegate = new WtBWVDelegate() };
    }
}

In above method Control is not available, but it is working loading the website.

public class WebViewPageRenderer : ViewRenderer<Xamarin.Forms.WebView, UIWebView>
{
        protected override void OnElementChanged(ElementChangedEventArgs<UIWebView> e)
    {

//Control is always null
if(Control != null)
{

        }
    }
}

In ViewRenderer method control is always null and even creating new WebView class also not loading the website.
I have created many renderers like entry, editor controls, here only I am facing problem


Viewing all articles
Browse latest Browse all 75885

Trending Articles



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