【问题标题】:FSCalendar+Persian: How to change weekday order?FSCalendar+Persian:如何更改工作日顺序?
【发布时间】:2022-08-20 19:30:14
【问题描述】:

我在我的项目中使用了 Objective-c,并使用了 FSCalendar+Persian pod。

这是我显示日历的代码:

calendar = [[FSCalendar alloc] initWithFrame:CGRectMake(0, 0, _calendarContainer.frame.size.width, _calendarContainer.frame.size.height)];
calendar.locale = [NSLocale localeWithLocaleIdentifier:@\"fa_IR\"];
calendar.calendarIdentifier = NSCalendarIdentifierPersian;
calendar.firstWeekday = 1;
calendar.placeholderType = FSCalendarPlaceholderTypeNone;
calendar.dataSource = self;
calendar.delegate = self;

calendar.appearance.headerTitleColor = [UIColor primaryColor];
calendar.appearance.headerTitleFont = [UIFont fontWithName:NSLocalizedString(@\"DefaultFontBold\", @\"\") size:15];
calendar.appearance.weekdayTextColor = [UIColor primaryColor];

calendar.appearance.selectionColor = [UIColor clearColor];
calendar.appearance.borderSelectionColor = [UIColor primaryColor];
calendar.appearance.titleSelectionColor = [UIColor primaryColor];

calendar.appearance.titleDefaultColor = [UIColor primaryColor];

calendar.appearance.todayColor = [UIColor primaryColor];
calendar.appearance.titleTodayColor = [UIColor whiteColor];

calendar.appearance.titleFont = [UIFont fontWithName:NSLocalizedString(@\"DefaultFont\", @\"\") size:14];

calendar.appearance.titleWeekendColor = [UIColor redColor];
calendar.calendarWeekdayView.weekdayLabels[5].textColor = [UIColor redColor];

[_calendarContainer addSubview:calendar];

在我的国家,第一个工作日是星期六(شنبه),最后一个工作日是星期五(جمعه)。

我的问题是我希望第一周是右侧的第一列而不是左侧,最后一周是左侧的第一列。

我该如何解决这个问题?

  • 你试过玩这个属性吗? calendar.firstWeekday = 1;
  • 是的,只是移动红色列的位置。
  • calendar.firstWeekday 只是将列颜色更改为红色。不改变列的位置。

标签: objective-c fscalendar


【解决方案1】:

我发现是什么问题,问题出在这行代码中:

calendar.locale = [NSLocale localeWithLocaleIdentifier:@"fa_IR"];

我必须将fa_IR 更改为fa-IR(将下划线更改为破折号),问题就解决了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-22
    相关资源
    最近更新 更多