| 114 | } |
| 115 | |
| 116 | void TableView::reloadData() |
| 117 | { |
| 118 | _oldDirection = Direction::NONE; |
| 119 | |
| 120 | for (const auto& cell : _cellsUsed) |
| 121 | { |
| 122 | if (_tableViewDelegate != nullptr) |
| 123 | { |
| 124 | _tableViewDelegate->tableCellWillRecycle(this, cell); |
| 125 | } |
| 126 | |
| 127 | _cellsFreed.pushBack(cell); |
| 128 | |
| 129 | cell->reset(); |
| 130 | if (cell->getParent() == this->getContainer()) |
| 131 | { |
| 132 | this->getContainer()->removeChild(cell, false); |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | _indices->clear(); |
| 137 | _cellsUsed.clear(); |
| 138 | |
| 139 | this->_updateCellPositions(); |
| 140 | this->_updateContentSize(); |
| 141 | if (_dataSource->numberOfCellsInTableView(this) > 0) |
| 142 | { |
| 143 | this->scrollViewDidScroll(this); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | TableViewCell* TableView::cellAtIndex(ssize_t idx) |
| 148 | { |