JTCalendar icon indicating copy to clipboard operation
JTCalendar copied to clipboard

Fit for number of weeks

Open brightsider opened this issue 8 years ago • 1 comments

How to change calendar height for fit number of weeks when pageViewNumberOfWeeks = 0?

brightsider avatar Sep 29 '16 08:09 brightsider

i think you can custom JTHorizontalCalendarView and JTDateHelper has supple the method

  • (NSUInteger)numberOfWeeks:(NSDate *)date { NSDate *firstDay = [self firstDayOfMonth:date]; NSDate *lastDay = [self lastDayOfMonth:date];

    NSDateComponents *componentsA = [self.calendar components:NSCalendarUnitWeekOfYear fromDate:firstDay]; NSDateComponents *componentsB = [self.calendar components:NSCalendarUnitWeekOfYear fromDate:lastDay];

    // weekOfYear may return 53 for the first week of the year return (componentsB.weekOfYear - componentsA.weekOfYear + 52 + 1) % 52; }

liuliangju avatar Oct 14 '16 06:10 liuliangju