I have an interesting trouble:
I have a NSArray which is populated with some animals name (strings). And I use this array to populate UITableView. When you press on any cell (animal), you move in a detail view and you read more about this animal. Then, I improved my app and now in UITableView the first cell is the cell which just says how many animals in the UITableView. Its like:
Animals found: 4 (first cell)
- Dog (second cell)
- Cat (third cell and etc.)
- Hamster
- Snake
The problem is, that when you press on the first cell (Animals found: 4) you move in the detail view of a random animal. It happens because in the array at index 0 there is an animal. Therefore, you move in the detail view of this animal. I don’t want to do anything when user presses the first cell. How can I reach it ?
I think the better solution is to represent in your model what you want to see in your views. So I would do it like this:
Now no special logic is required anywhere else except as @Praveen-K suggests when configuring cell at indexPath.row = 0…