Reputation: 12444
I am trying to implement a UITableView where the odd indexes are a 'separator'. The problem is, when I have one object in my dataSource and load the tableView, I see the first cell fine. However, when there are two objects in my dataSource and then load the tableView, I only see the one cell even though there should be two cells. I have tried to reloadData to cell if that would change anything and it did not.
If you need code to see, just let me know!
Upvotes: 0
Views: 80
Reputation: 15722
I suspect your problem is in tableView:numberOfRowsInSection:
. Because you are inserting "spacer" cells before your table's data cells, the number of rows returned from that method needs to take into account the spacer cells also, so the correct number to return is twice the number of elements in your array.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [self.cellArray count] * 2;
}
Upvotes: 1