CollectionView I tried to modify the height of the CollectionView using different methods like "calendar.collectionView.fs_height = 60" but nothing works. The CollectionView's height is calculated by a function. So I'm trying to disable this function or just be able to modify the height. Thanks!
this is the code
import UIKit import FSCalendar import SnapKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let calendar = FSCalendar(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 224))
calendar.weekdayHeight = 30
calendar.dataSource = self
calendar.delegate = self
calendar.scope = .week
calendar.register(FSCalendarCell.self, forCellReuseIdentifier: "Cell")
view.addSubview(calendar)
}
func calendar(_ calendar: FSCalendar, boundingRectWillChange bounds: CGRect, animated: Bool) {
calendar.snp.updateConstraints { (make) in
make.height.equalTo(bounds.height)
make.top.equalTo(40)
}
self.view.layoutIfNeeded()
}
}
extension ViewController: FSCalendarDelegate, FSCalendarDataSource {
func calendar(_ calendar: FSCalendar, cellFor date: Date, at position: FSCalendarMonthPosition) -> FSCalendarCell {
let cell = calendar.dequeueReusableCell(withIdentifier: "Cell", for: date, at: position)
cell.fs_height = 35
return cell
}
}