コード例 #1
0
        private void ConfigureCollectionView()
        {
            ImagePickerView.BackgroundColor = Appearance.BackgroundColor;
            CollectionView.BackgroundColor  = Appearance.BackgroundColor;

            //create animator
            _collectionViewCoordinator = new CollectionViewUpdatesCoordinator(CollectionView);

            //configure flow layout
            var collectionViewLayout = (UICollectionViewFlowLayout)CollectionView.CollectionViewLayout;

            collectionViewLayout.ScrollDirection         = LayoutConfiguration.ScrollDirection;
            collectionViewLayout.MinimumInteritemSpacing = LayoutConfiguration.InterItemSpacing;
            collectionViewLayout.MinimumLineSpacing      = LayoutConfiguration.InterItemSpacing;

            //finish configuring collection view
            CollectionView.DataSource = _collectionViewDataSource;
            CollectionView.Delegate   = _collectionViewDelegate;
            CollectionView.AllowsMultipleSelection        = true;
            CollectionView.ShowsVerticalScrollIndicator   = false;
            CollectionView.ShowsHorizontalScrollIndicator = false;
            //apply cell registrator to collection view
            CollectionView.Apply(CellRegistrator, CaptureSettings.CameraMode);

            switch (LayoutConfiguration.ScrollDirection)
            {
            case UICollectionViewScrollDirection.Horizontal:
                CollectionView.AlwaysBounceHorizontal = true;
                break;

            case UICollectionViewScrollDirection.Vertical:
                CollectionView.AlwaysBounceVertical = true;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }