CTableView* TuiManager::createTableView(float tag, Color4B color, int dir, int num, int cellWidth, int cellHeight, float x, float y, float w, float h, float rotation){ CTableView *pView = CTableView::create(Size(w,h)); if (color.a != 0) pView->setBackgroundColor(color); pView->setAutoRelocate(true); pView->setRotation(rotation); pView->setDirection((CScrollViewDirection)dir); pView->setCountOfCell(num); pView->setSizeOfCell(Size(cellWidth, cellHeight)); pView->setRotation(rotation); pView->setPosition(x,-y); pView->setTag(tag); return pView; }
bool CTableViewBasicTest::init() { CTableViewTestSceneBase::init(); setTitle("CTableViewBasicTest"); setDescription("TableView basic test"); CTableView* pTable = CTableView::create( Size(74.0f * 5, 70.0f), Size(74.0f, 70.0f), 50, this, ccw_datasource_adapter_selector(CTableViewBasicTest::tableviewDataSource)); pTable->setPosition(Vec2(480, 320)); pTable->setBackgroundColor(Color4B::GRAY); m_pWindow->addChild(pTable); pTable->reloadData(); return true; }