0

I have a list ,on which if I select any item ,it navigates to another controller called testCotroller,here in viewdidload method I am setting my custom delegate,where i have defined ShouldstartLoad. Shouldstartload is getting called when url loads first time,but when click a link or button which redirects to another url,at that point of time shouldstartload is not getting called..Here are my codes

//Controller

public override void ViewDidLoad()
    {
        base.ViewDidLoad();


        this.Title = "Dashboard";

        testDelegate testDelegate = new testDelegate(this);
        this.WebView.Delegate = (UIWebViewDelegate)webViewDelegate;

//its already initialized
this.testViewModel.PropertyChanged += this.testViewModel_PropertyChanged;
    }
private void testViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
    {
this.WebView.LoadRequest(url);
}


//Delegate
internal class testDelegate: UIWebViewDelegate
{
    UIViewController currentInstance;

    public testDelegate( UIViewController currentInstance)
    {

        currentInstance = this.currentInstance;
    }

    public override void LoadFailed(UIWebView webView, NSError error)
    {

    }

    public override void LoadingFinished(UIWebView webView)
    {

        return;
    }

    public override bool ShouldStartLoad(UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navigationType)
    {
     //doing some work

        return true;
    }

When I click an link /button in webview,shouldstartload should get called..

SushiHangover
  • 73,120
  • 10
  • 106
  • 165
uncle_scrooge
  • 409
  • 1
  • 5
  • 28

0 Answers0