Frage

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

War es hilfreich?

Lösung

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

Andere Tipps

  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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top