示例#1
0
        private void RegisterCells(UITableView view, bool fromNibs)
        {
            if (fromNibs)
            {
                foreach (var item in datasource.HeaderViews.Union(datasource.FooterViews))
                {
                    view.RegisterNibForHeaderFooterViewReuse(NibLocator.Nib(item.ViewType), item.Identifier);
                }

                foreach (var item in datasource.CellViews)
                {
                    view.RegisterNibForCellReuse(NibLocator.Nib(item.ViewType), item.Identifier);
                }
            }
            else
            {
                foreach (var item in datasource.HeaderViews.Union(datasource.FooterViews))
                {
                    view.RegisterClassForHeaderFooterViewReuse(item.ViewType, item.Identifier);
                }

                foreach (var item in datasource.CellViews)
                {
                    view.RegisterClassForCellReuse(item.ViewType, item.Identifier);
                }
            }
        }
示例#2
0
        private void RegisterCells(UICollectionView view, bool fromNibs)
        {
            view.RegisterClassForSupplementaryView(typeof(UICollectionReusableView), UICollectionElementKindSection.Header, "___empty___");

            if (fromNibs)
            {
                foreach (var item in datasource.HeaderViews)
                {
                    view.RegisterNibForSupplementaryView(NibLocator.Nib(item.ViewType), UICollectionElementKindSection.Header, item.Identifier);
                }

                foreach (var item in datasource.FooterViews)
                {
                    view.RegisterNibForSupplementaryView(NibLocator.Nib(item.ViewType), UICollectionElementKindSection.Footer, item.Identifier);
                }

                foreach (var item in datasource.CellViews)
                {
                    view.RegisterNibForCell(NibLocator.Nib(item.ViewType), item.Identifier);
                }
            }
            else
            {
                foreach (var item in datasource.HeaderViews)
                {
                    view.RegisterClassForSupplementaryView(item.ViewType, UICollectionElementKindSection.Header, item.Identifier);
                }

                foreach (var item in datasource.FooterViews)
                {
                    view.RegisterClassForSupplementaryView(item.ViewType, UICollectionElementKindSection.Footer, item.Identifier);
                }

                foreach (var item in datasource.CellViews)
                {
                    view.RegisterClassForCell(item.ViewType, item.Identifier);
                }
            }
        }