Q:

Due to heightAnchor, not able to scroll the collectionview vertically

Using the custom UICollectionViewLayout for collection view. To show the collection view properly for all the iPhone, i am using heightAnchor. After applying heightAnchor, i am not able to scroll vertically. Please help me.
This is for collectionview vertical scroll issue due to heightAnchor.
customizeCollectionView.translatesAutoresizingMaskIntoConstraints = false
customizeCollectionView.heightAnchor.constraint(equalToConstant:customizeCollectionView.contentSize.height).isActive = true
customizeCollectionView.widthAnchor.constraint(equalToConstant: self.view.frame.size.width).isActive = true
customizeCollectionView.topAnchor.constraint(equalTo:self.view.topAnchor , constant:(((20 + (navigationController?.navigationBar.frame.height)!) + self.layer.frame.height))).isActive = true
customizeCollectionView.leftAnchor.constraint(equalTo:self.view.leftAnchor , constant:39).isActive = true

collection view should scroll vertically but actually it is not scrolling. 

A:

 customizeCollectionView.heightAnchor.constraint(equalToConstant:customizeCollectionView.contentSize.height).isActive = true

You cannot set the height of a collection view related to its content view. It should be always related to its supper view. 

