collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: frame.width, height: frame.height))
Initialization methods such as two parameters are not used in uicollectionview
Solution
collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: frame.width, height: frame.height),collectionViewLayout: flowLayout)
The supplement is all the source code in init Code:
override init(frame: CGRect) {
flowLayout = UICollectionViewFlowLayout()
flowLayout.headerReferenceSize = .zero
flowLayout.footerReferenceSize = .zero
flowLayout.minimumLineSpacing = 0
flowLayout.minimumInteritemSpacing = 0
flowLayout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
flowLayout.scrollDirection = .horizontal
collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: frame.width, height: frame.height),collectionViewLayout: flowLayout)
pageControl = UIPageControl()
super.init(frame:frame)
self.setupViews()
}
Similar Posts:
- Ffmpeg scaling — the solution of “width / height not divisible by 2”
- [Solved] echart Error: Can’t get dom width or height
- ScrollView has ambiguous scrollable content height
- [Solved] Java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout
- A problem with 0 document. Documentelement. Clientwidth
- The difference between Top.location and window.location.href
- Python Typeerror: super() takes at least 1 argument (0 given) error in Python
- Document.body.clientheight cannot get the browser page height correctly
- Recyclerview Error: recyclerview No adapter attached; skipping layout
- How to Solve Vue Import Chinese Map & Echarts Import China Error