Ejemplo n.º 1
0
        protected virtual void SetUpNewElement(ItemsView newElement)
        {
            if (newElement == null)
            {
                return;
            }

            UpdateLayout();
            ItemsViewController = CreateController(newElement, _layout);

            if (Forms.IsiOS11OrNewer)
            {
                // We set this property to keep iOS from trying to be helpful about insetting all the
                // CollectionView content when we're in landscape mode (to avoid the notch)
                // The SetUseSafeArea Platform Specific is already taking care of this for us
                // That said, at some point it's possible folks will want a PS for controlling this behavior
                ItemsViewController.CollectionView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Never;
            }

            SetNativeControl(ItemsViewController.View);
            ItemsViewController.CollectionView.BackgroundColor = UIColor.Clear;
            ItemsViewController.UpdateEmptyView();
            ItemsViewController.UpdateFooterView();
            ItemsViewController.UpdateHeaderView();

            UpdateHorizontalScrollBarVisibility();
            UpdateVerticalScrollBarVisibility();

            // Listen for ScrollTo requests
            newElement.ScrollToRequested += ScrollToRequested;
        }
Ejemplo n.º 2
0
        protected virtual void SetUpNewElement(ItemsView newElement)
        {
            if (newElement == null)
            {
                return;
            }

            _layout             = SelectLayout(newElement.ItemsLayout);
            ItemsViewController = CreateController(newElement, _layout);
            SetNativeControl(ItemsViewController.View);
            ItemsViewController.CollectionView.BackgroundColor = UIColor.Clear;
            ItemsViewController.UpdateEmptyView();

            // Listen for ScrollTo requests
            newElement.ScrollToRequested += ScrollToRequested;
        }
Ejemplo n.º 3
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                TearDownOldElement(Element);

                ItemsViewController?.Dispose();
                ItemsViewController = null;
            }

            base.Dispose(disposing);
        }
        public override void CellDisplayingEnded(UICollectionView collectionView, UICollectionViewCell cell, NSIndexPath indexPath)
        {
            if (ItemsViewLayout.ScrollDirection == UICollectionViewScrollDirection.Horizontal)
            {
                var actualWidth = collectionView.ContentSize.Width - collectionView.Bounds.Size.Width;
                if (collectionView.ContentOffset.X >= actualWidth || collectionView.ContentOffset.X < 0)
                {
                    return;
                }
            }
            else
            {
                var actualHeight = collectionView.ContentSize.Height - collectionView.Bounds.Size.Height;

                if (collectionView.ContentOffset.Y >= actualHeight || collectionView.ContentOffset.Y < 0)
                {
                    return;
                }
            }

            ItemsViewController.PrepareCellForRemoval(cell);
        }
 public UICollectionViewDelegator(ItemsViewLayout itemsViewLayout, ItemsViewController itemsViewController)
 {
     ItemsViewLayout     = itemsViewLayout;
     ItemsViewController = itemsViewController;
 }