summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Maps.iOS
diff options
context:
space:
mode:
authorRui Marinho <me@ruimarinho.net>2016-06-16 18:03:11 +0100
committerGitHub <noreply@github.com>2016-06-16 18:03:11 +0100
commit7ae79f49072d4543da80eaf443e214fdfa02ed9c (patch)
treed4332fa6a76b7f4ac27fad7a1c4d9f733b9f861c /Xamarin.Forms.Maps.iOS
parent122a1f2a4028d7359774f5f4987c51dc3573c5d6 (diff)
downloadxamarin-forms-7ae79f49072d4543da80eaf443e214fdfa02ed9c.tar.gz
xamarin-forms-7ae79f49072d4543da80eaf443e214fdfa02ed9c.tar.bz2
xamarin-forms-7ae79f49072d4543da80eaf443e214fdfa02ed9c.zip
[IOS] Update the current region of the MKMapView when visibility is changed (#172)
Diffstat (limited to 'Xamarin.Forms.Maps.iOS')
-rw-r--r--Xamarin.Forms.Maps.iOS/MapRenderer.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Xamarin.Forms.Maps.iOS/MapRenderer.cs b/Xamarin.Forms.Maps.iOS/MapRenderer.cs
index 94d5eee9..c556d141 100644
--- a/Xamarin.Forms.Maps.iOS/MapRenderer.cs
+++ b/Xamarin.Forms.Maps.iOS/MapRenderer.cs
@@ -134,6 +134,7 @@ namespace Xamarin.Forms.Maps.iOS
public class MapRenderer : ViewRenderer
{
CLLocationManager _locationManager;
+ bool _shouldUpdateRegion;
public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint)
{
@@ -215,6 +216,19 @@ namespace Xamarin.Forms.Maps.iOS
UpdateHasScrollEnabled();
else if (e.PropertyName == Map.HasZoomEnabledProperty.PropertyName)
UpdateHasZoomEnabled();
+ else if (e.PropertyName == VisualElement.IsVisibleProperty.PropertyName && ((Map)Element).LastMoveToRegion != null)
+ _shouldUpdateRegion = true;
+ }
+
+ public override void LayoutSubviews()
+ {
+ base.LayoutSubviews();
+ if (_shouldUpdateRegion)
+ {
+ MoveToRegion(((Map)Element).LastMoveToRegion, false);
+ _shouldUpdateRegion = false;
+ }
+
}
void AddPins(IList pins)