【问题标题】:NSCalendarUnit.Type doesnt have a member named CalendarUnitWeekDayNSCalendar Unit.Type 没有名为 CalendarUnitWeekDay 的成员
【发布时间】:2015-06-26 09:35:15
【问题描述】:
let currentDayOfWeek = NSCalendar.currentCalendar().component(.CalendarUnitWeekday, fromDate: NSDate())

在这个地方我得到一个错误:

NSCalendarUnit.Type 没有名为 CalendarUnitWeekDay 的成员

【问题讨论】:

    标签: nscalendar swift2


    【解决方案1】:

    没有,有Weekday,可以这样使用:

    let calendar = NSCalendar.currentCalendar()
    let component = calendar.component(.Weekday, fromDate:NSDate())
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-23
      • 2014-11-09
      • 2015-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-26
      • 2013-05-23
      相关资源
      最近更新 更多