FSCalendar icon indicating copy to clipboard operation
FSCalendar copied to clipboard

When scope toggle, wrong height delegate in boundingRectWillChange

Open waiphyo-0gravity opened this issue 5 years ago • 4 comments

I swiped to this month, August which has extra height and boundingRectWillChange return correct height Simulator Screen Shot - iPhone 11 Pro - 2020-02-06 at 16 57 16 After changed scope to week and back to month, it returned wrong one Simulator Screen Shot - iPhone 11 Pro - 2020-02-06 at 16 57 36

PS: seems like it always happen when I choose day in first row.

waiphyo-0gravity avatar Feb 06 '20 10:02 waiphyo-0gravity

这个问题,你解决了吗?我这边的也遇到了同样问题

Ama-SmallBoy avatar Jul 01 '20 09:07 Ama-SmallBoy

@waiphyo-0gravity 那个问题你解决了吗

taojeff avatar Mar 31 '24 05:03 taojeff

same problem! help @WenchaoD

zhudi12358 avatar May 08 '24 08:05 zhudi12358

same problem! help @WenchaoD

在FSCalendar文件.h中的currentPage下面增加一个新的属性@property (strong, nonatomic) NSDate *use_currentPage;然后再.m文件的方法- (CGSize)sizeThatFits:(CGSize)size scope:(FSCalendarScope)scope { CGFloat headerHeight = self.preferredHeaderHeight; CGFloat weekdayHeight = self.preferredWeekdayHeight; CGFloat rowHeight = self.rowHeight > 0 ? self.rowHeight : self.preferredRowHeight; CGFloat paddings = self.collectionViewLayout.sectionInsets.top + self.collectionViewLayout.sectionInsets.bottom;

if (!self.floatingMode) {
    switch (scope) {
        case FSCalendarScopeMonth: {
            CGFloat height = weekdayHeight + headerHeight + [self.calculator numberOfRowsInMonth:_use_currentPage]*rowHeight + paddings;
            return CGSizeMake(size.width, height);
        }
        case FSCalendarScopeWeek: {
            CGFloat height = weekdayHeight + headerHeight + rowHeight + paddings;
            return CGSizeMake(size.width, height);
        }
    }
} else {
    return CGSizeMake(size.width, self.fs_height);
}
return size;

}进行换成你的那个即可,外面使用的时候赋值use_currentPage值就能解决这个问题

taojeff avatar May 08 '24 09:05 taojeff