문제

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