我正在为欧洲市场的应用程序制作自定义日历视图。在一个函数中,我应该得到星期几......我这样做了,但它返回从星期日开始的星期几。从星期一开始,我应该如何硬编码返回这个号码?谢谢 这是我到目前为止所拥有的:
-(int)getWeekDay:(NSDate*)date_
{
NSLocale *frLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"fr_FR"];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
[gregorian setLocale:frLocale];
NSDateComponents *comps = [gregorian components:NSWeekdayCalendarUnit fromDate:date_];
int weekday = [comps weekday];
NSLog(@"Week day is %i", weekday);
return weekday;
}