UICollectionView draw lines between the cells

Is there a way to draw lines between the cells in a UICollectionView? I'm not looking to add a border to each cell, that will result in drawing the lines only if there are any cells in the collection. What I'm looking for is something like UITableView's lines: they are there even if the table view has 0 cells.


I solved this by adding views to the collectionView. I used the cell frames coordinates to determine where I wanted to draw.

However, there is probably a better way of doing this?

You can create a proper background for UITableView if your cells are of the same height. Draw the pattern image and apply it as a backgroundColor property:

UIImage *patternImage = [UIImage imageNamed:@"pattern.png"];
tableView.backgroundColor = [UIColor colorWithPatternImage:patternImage];

UPD: Comment to this answer in incorrect. Background will scroll with tableView (or scrollView) content.

Need Your Help

Is it more efficient to always run a delete query, or to check if that information exists first

php mysql performance

Is it more efficient to always run a DELETE query by default whether an entry exists or not, for example to delete a user name after a certain period of time (DELETE * from table WHERE username='us...

LineChart listener is not working or i miss something


my problem is I set Chart.setOnChartValueSelectedListener but when I click on value there is no any action.