Exemplo n.º 1
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && _insetTracker != null)
            {
                _insetTracker.Dispose();
                _insetTracker = null;

                var viewsToLookAt = new Stack <UIView>(Subviews);
                while (viewsToLookAt.Count > 0)
                {
                    var view             = viewsToLookAt.Pop();
                    var viewCellRenderer = view as ViewCellRenderer.ViewTableCell;
                    if (viewCellRenderer != null)
                    {
                        viewCellRenderer.Dispose();
                    }
                    else
                    {
                        foreach (var child in view.Subviews)
                        {
                            viewsToLookAt.Push(child);
                        }
                    }
                }
            }

            base.Dispose(disposing);
        }
Exemplo n.º 2
0
        protected override void OnElementChanged(ElementChangedEventArgs <TableView> e)
        {
            if (e.NewElement != null)
            {
                var style = GetTableViewStyle(e.NewElement.Intent);

                if (Control == null || Control.Style != style)
                {
                    if (Control != null)
                    {
                        _insetTracker.Dispose();
                        Control.Dispose();
                    }

                    var tv = CreateNativeControl();
                    _originalBackgroundView = tv.BackgroundView;

                    SetNativeControl(tv);
                    if (PlatformVersion.IsAtLeast(9))
                    {
                        tv.CellLayoutMarginsFollowReadableWidth = false;
                    }

                    _insetTracker = new KeyboardInsetTracker(tv, () => Control.Window, insets => Control.ContentInset = Control.ScrollIndicatorInsets = insets, point =>
                    {
                        var offset = Control.ContentOffset;
                        offset.Y  += point.Y;
                        Control.SetContentOffset(offset, true);
                    }, this);
                }

                SetSource();
                UpdateRowHeight();
                UpdateEstimatedRowHeight();
                UpdateBackgroundView();
            }

            base.OnElementChanged(e);
        }