Forum Xamarin.iOS

Why is setting a delegate to null required?

I am pulling bits and pieces from this tutorial https://docs.microsoft.com/en-us/xamarin/ios/user-interface/controls/ios-maps/ios-maps-walkthrough#ViewController and I got this code that works:

                ImageMapDelegate mapDelegate = new ImageMapDelegate();

                ThreadJourneyMap.Delegate = null;
                ThreadJourneyMap.Delegate = mapDelegate;

But if I remove the

ThreadJourneyMap.Delegate = null;

I get a "Event registration is overwriting existing delegate..." error. Whats up with that?

Answers

Sign In or Register to comment.