Forum Xamarin.iOS
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

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.