I can at least two ways to do this:
1) Create an empty cell that will be transparent and of any desired height, and then use this cell for the rows in the index 1,3,5,7,9,11 ...
I used this approach before to create custom separator cells, and you can do the same, look at the space between the cells, like a big transparent separator cell. I sent a code to this question to view.
2) The second option is to simply use the image with the transparent part at the bottom, so the cells look as if they have a space between them.
To return different heights for different types of cells, follow these steps:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row % 2 == 0) { // this is a regular cell return REGULAR_CELL_HEIGHT; } else { // this is a "space" cell return SPACE_CELL_HEIGHT; } }
You will probably want to turn off any selection and user interaction with the "space" cells, so all you have to do is add to the cellForRowAtIndexPath method:
if (indexPath.row % 2 == 0) { cell.userInteractionEnabled = YES; } else { cell.userInteractionEnabled = NO; }
This will block any user interaction with the cell, if you want to not show the blue color of the selection when the user clicks on the cell, but you still want the didSelectRowAtIndexPath delegate method to didSelectRowAtIndexPath called, replace the above code with:
if (indexPath.row % 2 == 0) { cell.selectionStyle = UITableViewCellSelectionStyleBlue; } else { cell.selectionStyle = UITableViewCellSelectionStyleNone; }