Question

I have a custom UICollectionViewCell. After I return it from UICollectionView's datasource, what retains it?

Was it helpful?

Solution

The cell is added to the scroll view (= collection view). Views retain their subviews.

OTHER TIPS

  1. UICollectionView is the special scrollview which was inherited from UIScrollView.Refer this Documentation.

  2. Which will have collection of UICollectionViewCell inside of it.

  3. When you return it from cellForItemAtIndexPath as data source, it will be added (retained) to the UICollectionView by Apple's internal implementation.

So whenever you add some view to other view with addSubView: method , that will be added/retained by parent view.

Any View must have only one parent view. Not more than that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top