Sam
Sam

Reputation: 6395

gap between UITableViewCell

I need to place small gap between UITableViewCell, is there way that I can achieve this?

Upvotes: 1

Views: 5145

Answers (2)

Max
Max

Reputation: 1060

Declare a bigger height for the cell :

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 
    return realCellHeight + margin;
}

realCellHeight is the height value of your custom UITableViewCell in your XIB.

Upvotes: 1

William Remacle
William Remacle

Reputation: 1470

In UITableView you have 2 properties : separatorStyle and separatorColor, but maybe it is not enough for you.

Then you need to implement them by yourself : If your TableView has for example 12 cells you can use 12*2-1 cells (-1 because we don't need separator for the first cell) where odd number (starting from 0) will be your custom separator, with custom height, color or images like you would like but you have to do that by yourself.

0 => cell
1 => Separator
2 => cell
3 => Separator
4 => cell
...

I hope this will help you.

Upvotes: 8

Related Questions