You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 1, 2020. It is now read-only.
class TestViewController: UIViewController, UICollectionViewDataSource { @IBOutlet weak var collectionView: UICollectionView! @IBOutlet weak var layout: UICollectionViewFlowLayout!
UICollectionViewCell高度自适应,
用的是自定义cell 中的 preferredLayoutAttributesFitting 方法来返回每个cell的经计算后的不同高度
下拉刷新时,崩溃了, IOS12下是好的,也在项目中用了好久了
最小重现代码如下:
`import UIKit
import PullToRefreshKit
class TestViewController: UIViewController, UICollectionViewDataSource {
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var layout: UICollectionViewFlowLayout!
}
class MyCollectionViewCell: UICollectionViewCell {
override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
var newFrame = layoutAttributes.frame
newFrame.size.height = 100 // 这里根据内容计算出每个cell的不同高度
layoutAttributes.frame = newFrame
return layoutAttributes
}
}`