public AssetsAlbumViewController(AssetsPickerConfig pickerConfig) : base(null, null) { PickerConfig = pickerConfig; cancelButtonItem = new Lazy <UIBarButtonItem>(() => { var buttonItem = new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Plain, PressedCancel); return(buttonItem); }); searchButtonItem = new Lazy <UIBarButtonItem>(() => { var buttonItem = new UIBarButtonItem(UIBarButtonSystemItem.Search, PressedSearch); return(buttonItem); }); collectionView = new Lazy <UICollectionView>(() => { var isPortrait = UIApplication.SharedApplication.StatusBarOrientation.IsPortrait(); var layout = new AssetsAlbumLayout(); this.UpdateLayout(layout: layout, isPortrait: UIApplication.SharedApplication.StatusBarOrientation.IsPortrait()); layout.ScrollDirection = UICollectionViewScrollDirection.Vertical; var defaultSpace = this.PickerConfig.AlbumDefaultSpace; var itemSpace = this.PickerConfig.AlbumItemSpace(isPortrait: isPortrait); var view = new UICollectionView(frame: this.View.Bounds, layout: layout); view.RegisterClassForCell(this.PickerConfig.AlbumCellType, this.CellReuseIdentifier); view.RegisterClassForSupplementaryView(typeof(AssetsAlbumHeaderView), UICollectionElementKindSection.Header, this.HeaderReuseIdentifier); view.ContentInset = new UIEdgeInsets(top: defaultSpace, left: itemSpace, bottom: defaultSpace, right: itemSpace); view.BackgroundColor = UIColor.Clear; view.DataSource = this; view.Delegate = this; if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { view.PrefetchDataSource = this; } view.ShowsHorizontalScrollIndicator = false; view.ShowsVerticalScrollIndicator = true; return(view); }); }
public AssetsPhotoLayout(AssetsPickerConfig pickerConfig) : base() { PickerConfig = pickerConfig; }