fivenine-zurich / UnifiedMaps

A platform independent map implementation for Xamarin.Forms
MIT License
35 stars 12 forks source link

[Bug iOS] iOS12 The MapPinClicked and MapPinLongClicked Event are not fired #93

Closed Phenek closed 6 years ago

Phenek commented 6 years ago

Description

The MapPinClicked and MapPinLongClicked Event are not fired on iOS 12. The Map can be a MKNewAnnotationContainerView or a MKAnnotationContainerView. That's why it's not fired.

Code

in the iOS renderer ligne 300

// MKNewAnnotationContainerView is a private inner class, so you cannot compare directly
if (touch.View.Class.Name == "MKNewAnnotationContainerView")
   {
      var cgPoint = touch.LocationInView(Control);
      var location = Control.ConvertPoint(cgPoint, Control);
      if (touch.Timestamp - _touchBegan >= 1) // One second
        Element.SendMapLongClicked(new Position(location.Latitude, location.Longitude));
      else
        Element.SendMapClicked(new Position(location.Latitude, location.Longitude));
   }

I will do a PR at week-end. regards,

Phenek commented 6 years ago

I will use IsKindOfClass from the Apple Dev Documentation

Phenek commented 6 years ago

I think we need to fix this soon as possible for a 2.0.1 version

veryhumble commented 6 years ago

Hi Phenek,

Sorry, was away last Week. Thanks for the Fix, looked good and I merged it.

Will do a new Version 2.0.1. Do you have anything else that needs to be part of that Version?

Phenek commented 6 years ago

Next week I will do something but i'm not hundred percent sure, depends of my available time A 2.0.1 released version would be appreciated anyway.