private bool InitTableViewTestLayer() { var winSize = Layer.VisibleBoundsWorldspace.Size; var tableView = new CCTableView(this, new CCSize(250, 60)); tableView.Direction = CCScrollViewDirection.Horizontal; tableView.Position = new CCPoint(20, winSize.Height / 2 - 30); tableView.Delegate = this; this.AddChild(tableView); tableView.ReloadData(); tableView = new CCTableView(this, new CCSize(60, 280)); tableView.Direction = CCScrollViewDirection.Vertical; tableView.Position = new CCPoint(winSize.Width - 150, winSize.Height / 2 - 120); tableView.Delegate = this; tableView.VerticalFillOrder = CCTableViewVerticalFillOrder.FillTopDown; this.AddChild(tableView); tableView.ReloadData(); // Back Menu var itemBack = new CCMenuItemFont("Back", toExtensionsMainLayer); itemBack.Position = new CCPoint(winSize.Width - 50, 25); var menuBack = new CCMenu(itemBack); menuBack.Position = CCPoint.Zero; AddChild(menuBack); return true; }
public CCSize TableCellSizeForIndex(CCTableView table, int idx) { if (idx == 2) { return new CCSize(100, 100); } return new CCSize(60, 60); }
public virtual CCTableViewCell TableCellAtIndex(CCTableView table, int idx) { string str = idx.ToString(); var cell = table.DequeueCell(); if (cell == null) { cell = new CustomTableViewCell(); var sprite = new CCSprite("Images/Icon"); sprite.AnchorPoint = CCPoint.Zero; sprite.Position = new CCPoint(0, 0); cell.AddChild(sprite); var label = new CCLabelTtf(str, "Helvetica", 20.0f); label.Position = CCPoint.Zero; label.AnchorPoint = CCPoint.Zero; label.Tag = 123; cell.AddChild(label); } else { var label = (CCLabelTtf) cell.GetChildByTag(123); label.Text = (str); } return cell; }
public void TableCellWillRecycle(CCTableView table, CCTableViewCell cell) { }
public void TableCellUnhighlight(CCTableView table, CCTableViewCell cell) { }
public virtual void TableCellTouched(CCTableView table, CCTableViewCell cell) { CCLog.Log("cell touched at index: {0}", cell.Index); }
public virtual int NumberOfCellsInTableView(CCTableView table) { return 20; }