Beispiel #1
0
        public override CGSize GetReferenceSizeForHeader(UICollectionView collectionView, UICollectionViewLayout layout, nint section)
        {
            var width = UIScreen.MainScreen.Bounds.Width;

            return(ViewModel.TopBanners == null || HeaderReuseID.IsNullOrEmpty() || ViewModel.TopBanners.Count == 0 ?
                   CGSize.Empty
                    :
                   new CGSize(width, width * 9 / 16));
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement started");

            if (elementKind == UICollectionElementKindSectionKey.Header && !HeaderReuseID.IsNullOrEmtpy())
            {
                mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement HEADER resolving started");

                if (_headerDataContext != null)
                {
                    var headerView = collectionView.DequeueReusableSupplementaryView(elementKind, HeaderReuseID, indexPath);
                    mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement HEADER in process");
                    SetupReusableView(headerView, elementKind, indexPath, _headerDataContext);
                    return(headerView);
                }

                mvxLog.Warn("SupplementaryCollectionViewSource GetViewForSupplementaryElement _headerDataContext is NULL");

                mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement HEADER resolving ended");
            }
            else
            {
                mvxLog.Warn("SupplementaryCollectionViewSource GetViewForSupplementaryElement HEADER ID NULL");
            }

            if (elementKind == UICollectionElementKindSectionKey.Footer && !FooterReuseID.IsNullOrEmtpy())
            {
                mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement FOOTER resolving started");

                if (_footerDataContext != null)
                {
                    var footerView = collectionView.DequeueReusableSupplementaryView(elementKind, FooterReuseID, indexPath);
                    mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement FOOTER in process");
                    SetupReusableView(footerView, elementKind, indexPath, _headerDataContext);
                    return(footerView);
                }

                mvxLog.Warn("SupplementaryCollectionViewSource GetViewForSupplementaryElement _footerDataContext is NULL");

                mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement FOOTER resolving ended");
            }
            else
            {
                mvxLog.Warn("SupplementaryCollectionViewSource GetViewForSupplementaryElement FOOTER ID NULL");
            }

            mvxLog.Trace("SupplementaryCollectionViewSource GetViewForSupplementaryElement ended");

            return(null);
        }
        public override UICollectionReusableView GetViewForSupplementaryElement(UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
        {
            if (elementKind == UICollectionElementKindSectionKey.Header && !HeaderReuseID.IsNullOrEmtpy() && indexPath.Section == 1)
            {
                var headerView = collectionView.DequeueReusableSupplementaryView(elementKind, HeaderReuseID, indexPath);

                if (_headerDataContext != null)
                {
                    SetupReusableView(headerView, elementKind, indexPath, _headerDataContext);
                }

                return(headerView);
            }

            if (elementKind == UICollectionElementKindSectionKey.Header && !BannersHeaderReuseID.IsNullOrEmtpy() && indexPath.Section == 0)
            {
                var headerView = collectionView.DequeueReusableSupplementaryView(elementKind, BannersHeaderReuseID, indexPath);

                if (ViewModel != null)
                {
                    SetupReusableView(headerView, elementKind, indexPath, ViewModel);
                }

                return(headerView);
            }

            if (elementKind == UICollectionElementKindSectionKey.Footer && !FooterReuseID.IsNullOrEmtpy() && indexPath.Section == 1)
            {
                var footerView = collectionView.DequeueReusableSupplementaryView(elementKind, FooterReuseID, indexPath);

                if (ViewModel != null)
                {
                    SetupReusableView(footerView, elementKind, indexPath, ViewModel);
                }

                return(footerView);
            }

            return(null);
        }
 public virtual CGSize GetReferenceSizeForHeader(UICollectionView collectionView, UICollectionViewLayout layout, nint section)
 {
     return(HeaderReuseID.IsNullOrEmpty() ? CGSize.Empty : new CGSize(collectionView.Bounds.Width, 44));
 }