【问题标题】:NSDateComponentsNSDate组件
【发布时间】:2012-06-05 12:22:28
【问题描述】:

我已阅读 Zaph 的以下回答

iPhone - Correct way for getting current date and time for a given place / timezone and compare it with another date/time in the same place

问题是我看不懂下面的代码。

NSDate *newDate;
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:~ NSTimeZoneCalendarUnit fromDate:[NSDate date]];
newDate = [[NSCalendar currentCalendar] dateFromComponents:dateComponents];
....

我想解释一下在NSTimeZoneCalendarUnit之前使用~的原因。

谢谢。

【问题讨论】:

    标签: objective-c ios


    【解决方案1】:

    Apple 要求按位给出它们。这是 NOT 的 C 运算符。比较this

    【讨论】:

      猜你喜欢
      • 2012-06-26
      • 2015-08-14
      • 2015-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多