Hi,
How I can identifier the name the Cells.
I Have 3 cell, (Hotels, flights, Cars)
I have 3 objects hotels, cars, flights.
In my case the indexPath is wrong, because i Have:
1 hotels
2 flights
1 Cars
In my didSelectRowAt indexPath.row is not correct.
for access object.
I put in each cell on Text for number of index(This work) but i cant access cell.lbIndexPath.text.
I try
tnks, a million.
How I can identifier the name the Cells.
I Have 3 cell, (Hotels, flights, Cars)
Code Block func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell: UITableViewCell if hotels.count > 0 { cell = getHotelsCell(tableView, indexPath: indexPath) if cars.count > 0 { cell = getCarsCell(tableView, indexPath: indexPath) } if flights.count > 0 { cell = getFlightsCell(tableView, indexPath: indexPath) } return cell } }
I have 3 objects hotels, cars, flights.
In my case the indexPath is wrong, because i Have:
1 hotels
2 flights
1 Cars
In my didSelectRowAt indexPath.row is not correct.
for access object.
I put in each cell on Text for number of index(This work) but i cant access cell.lbIndexPath.text.
I try
Code Block func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if let cell = self.tableView(tableView, cellForRowAt: indexPath) as? UITableViewCell { /* this line cell is not identifier cell.lbIndexPath.text */ /* this if is wrong i know, this logic for index path */ if tableViewCell.name = Hotels { var index = cell.lbIndexPath.text open view details -> Hotels[index] } if tableViewCell.name = flights { var index = cell.lbIndexPath.text open view details -> flights[index] } if tableViewCell.name = Cars { var index = cell.lbIndexPath.text open view details -> flights[index] } }
tnks, a million.