private void LoadNotePanel() { if (noteList != null && noteList.Count > 0) { // collectionView InitializeCollectionView(typeof(NoteCell), "noteCell"); // layout collectionView.CollectionViewLayout = new NoteFlowLayout() { HeaderReferenceSize = new CGSize(collectionView.Frame.Width, 42) }; collectionView.RegisterClassForSupplementaryView(typeof(NoteHeader), UICollectionElementKindSection.Header, new NSString("noteHeader")); // dataSource NoteDataSource dataSource = new NoteDataSource(book, collectionView, "noteCell"); dataSource.ItemPressedEvent += HandleNotePressedEvent; dataSource.ScrolledEvent += HandleScrolledEvent; collectionView.Source = dataSource; collectionView.Delegate = new NoteCollectionViewDelegateFlowLayout(dataSource); collectionView.ReloadData(); collectionView.LayoutIfNeeded(); if (collectionView.ContentSize.Height < collectionView.Frame.Height) { floatMenu.Frame = new CGRect(floatMenu.Frame.X, centerView.Frame.Bottom + 64 - floatMenu.Frame.Height, floatMenu.Frame.Width, floatMenu.Frame.Height); } ShowHideNoteStatus(false); } else { ShowHideNoteStatus(true); } }
public NoteCollectionViewDelegateFlowLayout(NoteDataSource dataSource) { this.dataSource = dataSource; }