[iOS] Fix NRE when re-adding header/footer (#702)
authorJimmy Garrido <jimmygarrido@outlook.com>
Sat, 21 Jan 2017 00:36:59 +0000 (16:36 -0800)
committerKangho Hur <kangho.hur@samsung.com>
Fri, 24 Mar 2017 04:12:24 +0000 (13:12 +0900)
Xamarin.Forms.Platform.iOS/Renderers/ListViewRenderer.cs

index 3871c5c..3c23580 100644 (file)
@@ -414,6 +414,8 @@ namespace Xamarin.Forms.Platform.iOS
                        else if (_footerRenderer != null)
                        {
                                Control.TableFooterView = null;
+                               _footerRenderer.Element.MeasureInvalidated -= OnFooterMeasureInvalidated;
+
                                var platform = _footerRenderer.Element.Platform as Platform;
                                if (platform != null)
                                        platform.DisposeModelAndChildrenRenderers(_footerRenderer.Element);
@@ -458,6 +460,8 @@ namespace Xamarin.Forms.Platform.iOS
                        else if (_headerRenderer != null)
                        {
                                Control.TableHeaderView = null;
+                               _headerRenderer.Element.MeasureInvalidated -= OnHeaderMeasureInvalidated;
+                               
                                var platform = _headerRenderer.Element.Platform as Platform;
                                if (platform != null)
                                        platform.DisposeModelAndChildrenRenderers(_headerRenderer.Element);