سؤال

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