I have a UICollectionView like this:
These are the three different cases for it. Light grays shows the borders of the collection view and dark gray is for cells. I have set min spacing and section insets to 0. But still I am getting these unwanted insets, and it seems it only happens when there are more than 1 cell.
I calculate the item sizes like this:
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
guard let item = place?.publicTransports?[indexPath.row] else {
return CGSize.zero
}
var lines = ""
for (i, line) in item.lines.enumerate() {
lines.appendContentsOf(line)
if i != item.lines.count - 1 {
lines.appendContentsOf(", ")
}
}
let linesString = lines as NSString
return CGSize(width: linesString.sizeWithAttributes(nil).width + 35 + 20, height: collectionView.bounds.height/2)
}
Any suggestions?