Please consider the following code:
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("DataItemCell", forIndexPath: indexPath) as DataItemCollectionViewCell
println("\(cell.parametersView.subviews.count)")
return cell
}
and the view hierarchy of the cell:
I can't figure out why output is 0
.
What I'm trying to achieve is to recursively loop through all descendants of parametersView
.
I try to simulate a similar project and I had the same issue (my prototype cell wasn't used). Be sure that you don't have any
self.collectionView.registerClass(UICollectionViewCell, forCellWithReuseIdentifier: reuseIdentifier)
or
self.collectionView.registerClass(DataItemCollectionViewCell, forCellWithReuseIdentifier: "DataItemCell"DataItemCollectionViewCell)
anywhere in your code.
Usually, there is one in the func viewDidLoad()
function.
Edit:
Send me an exemple by mail, if you still have the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With