最近,iOS 地图注释中的一个行为发生了变化:
CalloutAccessoryControlTapped
当用户点击注释视图时,不再调用该事件。例如,如果我点击上图中的红色区域。触发事件的唯一方法是点击右侧的信息按钮。
CalloutAccessoryControlTapped
当我们点击注释的整个表面时,有没有办法强制提出?
protected override void OnElementChanged(ElementChangedEventArgs<View> e)
{
base.OnElementChanged(e);
if (Control is MKMapView nativeMap)
{
if (e.OldElement != null)
{
nativeMap.RemoveAnnotations(nativeMap.Annotations);
nativeMap.GetViewForAnnotation = null;
nativeMap.CalloutAccessoryControlTapped -= OnCalloutAccessoryControlTapped;
}
if (e.NewElement != null)
{
CustomMap = (CustomMap)e.NewElement;
nativeMap.GetViewForAnnotation = GetViewForAnnotation;
nativeMap.CalloutAccessoryControlTapped += OnCalloutAccessoryControlTapped;
}
}
}
// event delegate
private void OnCalloutAccessoryControlTapped(object sender, MKMapViewAccessoryTappedEventArgs e)
{
// ...
}