【发布时间】:2017-01-16 11:34:23
【问题描述】:
我正在为日历创建 UIView 子类,其中带有流式布局的 UICollectionView 用于显示日期。代码是:
override func draw(_ rect: CGRect)
{
super.draw(rect)
.
.
configureCalendarView()
.
}
func configureCalendarView()
{
cellWd = Double(self.frame.size.width)/7.0
let layout = UICollectionViewFlowLayout.init()
layout.minimumLineSpacing = 0.5
layout.minimumInteritemSpacing = 0.0
layout.sectionInset = UIEdgeInsetsMake(1, 0, 0, 0)
collectionV = UICollectionView.init(frame: CGRect(x: 0, y:90, width:self.frame.size.width, height:CGFloat(cellWd * 5 + 3.5)), collectionViewLayout: layout)
collectionV?.backgroundColor = self.backgroundColor
collectionV?.isScrollEnabled = false
collectionV?.register(DayCell.classForCoder(), forCellWithReuseIdentifier:reuseID)
collectionV?.dataSource = self;
collectionV?.delegate = self;
collectionV?.backgroundColor = calBgColor //lightgray
self.addSubview(collectionV!)
}
一切正常,但最小行距在第 2 行和第 3 行之间没有任何影响。下面是截图:
怎么了?任何帮助将不胜感激。谢谢!
【问题讨论】:
标签: ios swift uicollectionview spacing flowlayout