Beispiel #1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            List <ModelItem> unsortedItems = new List <ModelItem>();

            for (int i = 0; i < 30; i++)
            {
                ModelItem item = null;
                if (i == 0)
                {
                    item = new ModelItem(i, "Image");
                }
                else
                {
                    item = new ModelItem(i);
                }
                unsortedItems.Add(item);
            }

            CollectionViewDataSource collectionSource = new CollectionViewDataSource(unsortedItems);

            collectionSource.boundCollectionView   = unsortedCollectionView;
            this.unsortedCollectionView.DataSource = collectionSource;

            TableVIewDataSource tableSource = new TableVIewDataSource(15);

            this.tableView.DataSource = tableSource;

            this.dragRecognizer.AddTarget(new Action <NSObject>(HandleTableLongPress));
//			this.dragRecognizer.AddTarget(this, new ObjCRuntime.Selector("HandleLongPress:"));
            this.View.AddGestureRecognizer(this.dragRecognizer);
        }
Beispiel #2
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            TableCell cell = (TableCell)tableView.DequeueReusableCell("TableCell", indexPath);

            if (cell == null)
            {
                cell = (TableCell) new UITableViewCell();
            }
            CollectionViewDataSource collectionSource;

            try
            {
                collectionSource = this.cellDataSources[indexPath.Section];
            }
            catch
            {
                collectionSource = new CollectionViewDataSource();
                collectionSource.boundCollectionView = cell.collectionView;

                this.cellDataSources.Add(collectionSource);
            }

            cell.collectionView.DataSource = collectionSource;

            return(cell);
        }