From 94defe042ecdd40c70b490889ed4bc0d6a63cf94 Mon Sep 17 00:00:00 2001 From: Anthony BATTEL Date: Thu, 1 Dec 2016 17:51:31 +0100 Subject: [PATCH 1/3] fix crash on iOS 8 when entering-existing carousel caused by memory leak --- .../carouselView/dev/Shared.iOS/CarouselViewRenderer.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs b/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs index 0802501..27fb01d 100644 --- a/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs +++ b/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs @@ -233,8 +233,14 @@ protected override void Dispose(bool disposing) if (disposing && !_disposed) { _disposed = true; - if (Element != null) + if (Element != null) { ((ICarouselViewController)Element).CollectionChanged -= OnCollectionChanged; + if(_controller != null) { + _controller.Dispose(); + } + this.Control.Dispose(); + this.Dispose(); + } } base.Dispose(disposing); From 3d266b8d0981b2ccebddff1d7c72cf7bd3ea79b1 Mon Sep 17 00:00:00 2001 From: Anthony BATTEL Date: Thu, 5 Jan 2017 12:25:16 +0100 Subject: [PATCH 2/3] load initial position on first render --- txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs b/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs index 27fb01d..249fe4d 100644 --- a/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs +++ b/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs @@ -222,6 +222,7 @@ protected override void OnElementChanged(ElementChangedEventArgs e // initialize properties _position = Element.Position; + _controller.ReloadData(_position); // hook up crud events ((ICarouselViewController)newElement).CollectionChanged += OnCollectionChanged; @@ -255,7 +256,7 @@ public override void LayoutSubviews() base.Control.ReloadData(); _lastBounds = Bounds; - + var wasPortrait = _lastBounds.Height > _lastBounds.Width; var nowPortrait = Bounds.Height > Bounds.Width; if (wasPortrait != nowPortrait) From e75eade0a1f0d51ad0838a29c67f5ba81ac2ff6a Mon Sep 17 00:00:00 2001 From: Anthony BATTEL Date: Thu, 5 Jan 2017 12:27:40 +0100 Subject: [PATCH 3/3] Carousel View did not resize on rotation --- txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs b/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs index 249fe4d..97e098b 100644 --- a/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs +++ b/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs @@ -255,12 +255,13 @@ public override void LayoutSubviews() return; base.Control.ReloadData(); - _lastBounds = Bounds; var wasPortrait = _lastBounds.Height > _lastBounds.Width; var nowPortrait = Bounds.Height > Bounds.Width; if (wasPortrait != nowPortrait) _controller.ScrollToPosition(_position, false); + + _lastBounds = Bounds; } public override SizeRequest GetDesiredSize(double widthConstraint, double heightConstraint) {