我正在尝试将日历显示为星期日作为一周的第一天。它目前定于星期一。任何人都可以看看这个代码并修复它?它来自GitHub上的自定义日历:https://github.com/jubinjacob19/CustomCalendar
谢谢
NSDateComponents *components = [_gregorian components:_dayInfoUnits fromDate:_calendarDate];
components.day = 1;
NSDate *firstDayOfMonth = [_gregorian dateFromComponents:components];
NSDateComponents *comps = [_gregorian components:NSWeekdayCalendarUnit fromDate:firstDayOfMonth];
NSInteger weekdayBeginning = [comps weekday]; // Starts at 1 on Sunday
weekdayBeginning -=2;
if(weekdayBeginning < 0)
weekdayBeginning += 7; // Starts now at 0 on Monday
NSRange days = [_gregorian rangeOfUnit:NSDayCalendarUnit
inUnit:NSMonthCalendarUnit
forDate:_calendarDate];