Howto access the user's MKAnnotationView on iOS

Howto access the user's MKAnnotationView on iOS

According to&nbsp;<a href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/map/customized-pin" target="_blank">this</a>&nbsp;tutorial, I added a renderer for a&nbsp;CustomMap&nbsp;to my Xamarin.Forms iOS project. I would like to overwrite the basic&nbsp;Pin&nbsp;with the pin of the user's current location (i.e. the white/blue circle). So I added a class&nbsp;CustomMapRenderer, which overrides the method&nbsp;GetViewForAnnotationas follows

According to this tutorial, I added a renderer for a CustomMap to my Xamarin.Forms iOS project. I would like to overwrite the basic Pin with the pin of the user's current location (i.e. the white/blue circle). So I added a class CustomMapRenderer, which overrides the method GetViewForAnnotationas follows

protected override MKAnnotationView GetViewForAnnotation(MKMapView mapView, IMKAnnotation annotation)
    {
        MKAnnotationView annotationView = null;

    if (annotation is MKUserLocation)
        return null;

    var customPin = getTrackPin(annotation as MKPointAnnotation);
    if (customPin == null)
    {
        throw new Exception("Custom pin not found");
    }

    annotationView = mapView.DequeueReusableAnnotation(customPin.Id.ToString());
    if (annotationView == null)
    {
        annotationView = new TrackMKAnnotationView(annotation, customPin.Id.ToString());
        annotationView.Image = UIImage.FromFile("pin.png");
        annotationView.CalloutOffset = new CGPoint(0, 0);
        annotationView.LeftCalloutAccessoryView = new UIImageView(UIImage.FromFile("monkey.png"));
        annotationView.RightCalloutAccessoryView = UIButton.FromType(UIButtonType.DetailDisclosure);
        ((TrackMKAnnotationView)annotationView).Id = customPin.Id.ToString();
        ((TrackMKAnnotationView)annotationView).Url = customPin.url;
    }
    annotationView.CanShowCallout = true;

    return annotationView;
}

However, instead of doing

annotationView.Image = UIImage.FromFile("pin.png");

I would like to get the UIImage of the pin representing the user's current location, like so (pseudo-code):

annotationView.Image = UIImage.UserPin;

Is there a way to accomplish this?

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

C/C++ vs. Rust: A developer’s perspective

In this post, you'll see the difference between Rust and C/C++ in a developer’s perspective

How to use Objective C Cocoapods in Swift Framework

My swift framework has dependency of Objective C Framework. How do I use that ?