Вопрос

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

Это было полезно?

Решение

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

Другие советы

  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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top