I have added a UICollectionVIew
to a vertical Stack View
. I connected both datasource
and Delegate
from storyboard
and added the delegate/datasource
from the code as well.
However, the following method is not being called at all:
internal func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { ... }
But, the methods
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 2
}
are being called.
So, I moved the UICollectionVIew
out of the vertical Stack View
and it was working then. But, the method is not being called when the UICollectionVIew
is in the vertical Stack View
.
How can I solve this?