diff --git a/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs b/txt/src/carouselView/dev/Shared.iOS/CarouselViewRenderer.cs index 0802501..97e098b 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; @@ -233,8 +234,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); @@ -248,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) {