UILabel overloading in UICollectionView

后端 未结 2 661
臣服心动
臣服心动 2021-01-23 19:44

I am using UICollectionView. in collection view label is overload every time i am using this code

- (UICollectionViewCell *)collectionView:(UICollec         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-23 20:27

    You have to generate the instance of your label just once, for the life - time of the cell.

    But as I see in your method, you will get a new instance of the label every time the method is called.

    Basically, you can subclass a UICollectionViewCell and then generate the required label only once. In the delegate method shown here, you should only update them with required information.

提交回复
热议问题