【问题标题】:When using NSCalender and NSDateComponents how to set the first day of the week?使用 NSCalender 和 NSDateComponents 时如何设置一周的第一天?
【发布时间】:2011-03-15 00:56:28
【问题描述】:

我的应用的用户可以选择他们喜欢的一周的第一天(即每周从星期四开始)。

如何使用 NSCalender 和 NSDateComponents 调整一周的第一天?

【问题讨论】:

标签: iphone cocoa-touch ios4 iphone-sdk-3.0


【解决方案1】:
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
[calendar setFirstWeekday:5]; // 5 = Thursday, 1 = Sunday, 2 = Monday, etc.

【讨论】:

    猜你喜欢
    • 2012-08-22
    • 1970-01-01
    • 1970-01-01
    • 2014-08-28
    • 1970-01-01
    • 2019-08-30
    • 2019-10-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多