summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Maps.iOS
diff options
context:
space:
mode:
authorjcmanke <jmanke1227@gmail.com>2017-04-11 22:52:04 (GMT)
committerRui Marinho <me@ruimarinho.net>2017-04-11 22:52:04 (GMT)
commitdfda41b0bdc0ea80f548e3c919f14e8094c6cb25 (patch)
tree32dbdc4a31899c3c5e31329ad9d86bca21c4e235 /Xamarin.Forms.Maps.iOS
parentb832b67875789f2fccea5077c86238e75cf373ff (diff)
downloadxamarin-forms-dfda41b0bdc0ea80f548e3c919f14e8094c6cb25.zip
xamarin-forms-dfda41b0bdc0ea80f548e3c919f14e8094c6cb25.tar.gz
xamarin-forms-dfda41b0bdc0ea80f548e3c919f14e8094c6cb25.tar.bz2
Map renderer extensibility (#844)
* Added extensibility features to Maps Android MapRenderer: - Moved map initialization to protected virtual method OnMapReady, called by explicit implementation of IOnMapReady - Added protected virtual method CreateMarker for customization of pins iOS MapRenderer: - Added protected virtual method CreateAnnotation for customization of pins Pin: - Unsealed the Pin class - Made Label a bindable property * [Docs] Update docs
Diffstat (limited to 'Xamarin.Forms.Maps.iOS')
-rw-r--r--Xamarin.Forms.Maps.iOS/MapRenderer.cs16
1 files changed, 12 insertions, 4 deletions
diff --git a/Xamarin.Forms.Maps.iOS/MapRenderer.cs b/Xamarin.Forms.Maps.iOS/MapRenderer.cs
index 44d95aa..2fac61a 100644
--- a/Xamarin.Forms.Maps.iOS/MapRenderer.cs
+++ b/Xamarin.Forms.Maps.iOS/MapRenderer.cs
@@ -306,6 +306,16 @@ namespace Xamarin.Forms.Maps.MacOS
}
#endif
+ protected virtual IMKAnnotation CreateAnnotation(Pin pin)
+ {
+ return new MKPointAnnotation
+ {
+ Title = pin.Label,
+ Subtitle = pin.Address ?? "",
+ Coordinate = new CLLocationCoordinate2D(pin.Position.Latitude, pin.Position.Longitude)
+ };
+ }
+
void UpdateRegion()
{
if (_shouldUpdateRegion)
@@ -319,10 +329,8 @@ namespace Xamarin.Forms.Maps.MacOS
{
foreach (Pin pin in pins)
{
- var annotation = new MKPointAnnotation { Title = pin.Label, Subtitle = pin.Address ?? "" };
-
+ var annotation = CreateAnnotation(pin);
pin.Id = annotation;
- annotation.SetCoordinate(new CLLocationCoordinate2D(pin.Position.Latitude, pin.Position.Longitude));
((MKMapView)Control).AddAnnotation(annotation);
}
}
@@ -414,4 +422,4 @@ namespace Xamarin.Forms.Maps.MacOS
}
}
}
-} \ No newline at end of file
+}