I need cells one nearby another like below
but i am getting like this: in short phones they are very far from one another
for collectionview i have given constraints like this in stroryboard:
height = 80, leading = trailing = 0, top = 20
and in viewdidload:
override func viewDidLoad() {
super.viewDidLoad()
//services collectionview cell
let serviceLayout = UICollectionViewFlowLayout()
serviceLayout.minimumInteritemSpacing = 0
serviceLayout.minimumLineSpacing = 0
serviceLayout.estimatedItemSize = UICollectionViewFlowLayout.automaticSize
self.servicesCollectionView.collectionViewLayout = serviceLayout
servicesCollectionView.contentInsetAdjustmentBehavior = .always
servicesCollectionView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
}
i haven't given anything more then this.. please do help.. to get collectionview cells to come near to each cell
EDIT:
for servicesCollectionView i have comment everything in the didload and added like this.. then its working
servicesCollectionView.addObserver(self, forKeyPath: "contentSize", options: .new, context: nil)
for this cell i need to show near to each other, how to do that.. plz do suggest
galleryCollectionView.collectionViewLayout = LeftAlignCellCollectionFlowLayout()
let galleryLayout = UICollectionViewFlowLayout()
galleryLayout.scrollDirection = .horizontal
self.galleryCollectionView.collectionViewLayout = galleryLayout
self.galleryCollectionView!.contentInset = UIEdgeInsets(top: 0, left: 0, bottom:0, right: 0)
let heightGallery = 120
let widthGallery = view.frame.size.width
if let galleryLayout = self.galleryCollectionView.collectionViewLayout as? UICollectionViewFlowLayout {
galleryLayout.minimumInteritemSpacing = 0
galleryLayout.minimumLineSpacing = 0
galleryLayout.itemSize = CGSize(width: widthGallery * 0.7, height: CGFloat(heightGallery))
}

