HI,
How can I make the monthview width bigger?
I add another UILabel to the month view(FSCalendarHeaderCell) but i can't find a way to make its total width bigger. There's an option to adjust its height but not width
Thanks
@chamroeunbm
You can change FSCalendarHeaderCell width by implementing this code:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
changeMonthName()
}
func changeMonthName(){
let collectionView = self.calendar.calendarHeaderView.value(forKey: "collectionView") as! UICollectionView
collectionView.visibleCells.forEach { (cell) in
let c = cell as! FSCalendarHeaderCell
var frame = c.frame
frame.size.width = 250
c.frame = frame
c.setNeedsLayout()
}
}
// MARK:- FSCalendarDelegate
func calendarCurrentPageDidChange(_ calendar: FSCalendar) {
changeMonthName()
}
thanks
HI, this create a messy view after swiping a few month.
There're 3 visible cells. I try to change size of the second cells(current month) and deduct size of the previous month and next month, but this also doesn't work.
i think we need some more tweak to get it working properly.
Hi, this solution doesn't work. After scrolling a few month, all the month name corrupted and overlap each other
Most helpful comment
@chamroeunbm
You can change
FSCalendarHeaderCellwidth by implementing this code: