jjzjj

NSTimeinterval

全部标签

swift - setNavigationBarHidden(Bool, Bool) 动画的默认时间间隔

Swift动画的默认时间间隔是多少,例如的setNavigationBarHidden(Bool,animated:Bool)和setToolbarHidden(Bool,animated:Bool)方法>UINavigationController类?我想知道我的动画是否匹配相同的持续时间。 最佳答案 来自Appledocs:UINavigationControllerHideShowBarDurationAglobalconstantthatspecifiesapreferreddurationwhenanimatingthen

swift - 如何将 DispatchTimeInterval 转换为 NSTimeInterval(或 Double)?

我需要减去一个DispatchTimeInterval来自NSTimeInterval(或Double)。是否有一种标准方法可以将DispatchTimeInterval转换为NSTimeInterval? 最佳答案 DispatchTimeInterval是一个枚举:publicenumDispatchTimeInterval:Equatable{caseseconds(Int)casemilliseconds(Int)casemicroseconds(Int)casenanoseconds(Int)casenever}您可以使用

time - 你如何获得 "current system time"?

SKScene-update的文档如下:“当前系统时间”到底是什么?除了通过SKScene-update之外,我该如何获取它?我试过CFAbsoluteTimeGetCurrent(),但显然是这样Returnsthecurrentsystemabsolutetime[,whichis]ismeasuredinsecondsrelativetotheabsolutereferencedateofJan1200100:00:00GMT.并且与“当前系统时间”不同,根据我的测试,“当前系统时间”的值比“当前绝对时间”小几个数量级。 最佳答案

ios - 直接使用访问器的核心数据 NSTimeInterval 是错误的

我在NSManagedObject子类中使用setValueForKey设置NSTimeInterval,该值设置正确,并且在使用valueForKey检索时也是正确的,但是,如果直接使用访问器,它会返回不正确的值。这是演示问题的代码示例letdate=NSDate()//NSTimeIntervalSince1970=1447054145.15281self.setValueForKey(date,"dateLastSynced")self.valueForKey("dateLastSynced")//=1447054145.15281self.dateLastSynced//!!E

iphone - 如何将 NSTimeInterval 转换为 int?

如何将NSTimeInterval转换为整数值?我的TimeInterval的值是83.01837。我需要将其转换为83。我用谷歌搜索但找不到任何帮助。 最佳答案 直接赋值:NSTimeIntervalinterval=1002343.5432542;NSIntegertime=interval;//timeisnowequalto1002343NSTimeInterval是一个double值,因此如果您将它直接分配给一个NSInteger(或int,如果您愿意)它会起作用。这会将时间截断到最接近的秒数。如果您希望四舍五入到最接近的

iphone - 如何将 NSTimeInterval 转换为 int?

如何将NSTimeInterval转换为整数值?我的TimeInterval的值是83.01837。我需要将其转换为83。我用谷歌搜索但找不到任何帮助。 最佳答案 直接赋值:NSTimeIntervalinterval=1002343.5432542;NSIntegertime=interval;//timeisnowequalto1002343NSTimeInterval是一个double值,因此如果您将它直接分配给一个NSInteger(或int,如果您愿意)它会起作用。这会将时间截断到最接近的秒数。如果您希望四舍五入到最接近的

ios - 使用 NSTimeInterval 创建 dispatch_time_t

我有一个NSTimeInterval值,我需要用它创建一个dispatch_time_t值。这是我尝试过的:lettimeInterval:NSTimeInterval=getTimeInterval()//ERROR:Binaryoperator'*'cannotbeappliedtooperandsoftype'NSTimeInterval'and'UInt64'letdispatch_time=dispatch_time(DISPATCH_TIME_NOW,Int64(timerInterval*NSEC_PER_SEC))我理解这个错误消息,但我不知道如何摆脱它。有人可以提供一

ios - 使用 NSTimeInterval 创建 dispatch_time_t

我有一个NSTimeInterval值,我需要用它创建一个dispatch_time_t值。这是我尝试过的:lettimeInterval:NSTimeInterval=getTimeInterval()//ERROR:Binaryoperator'*'cannotbeappliedtooperandsoftype'NSTimeInterval'and'UInt64'letdispatch_time=dispatch_time(DISPATCH_TIME_NOW,Int64(timerInterval*NSEC_PER_SEC))我理解这个错误消息,但我不知道如何摆脱它。有人可以提供一

swift - 使用 Swift 查找 NSDates 之间的秒数差异作为整数

我正在编写一段代码,我想计算按下按钮的时间。为此,我在按下按钮时记录了一个NSDate(),并在释放按钮时尝试使用timeIntervalSinceDate函数。这似乎可行,但我找不到任何方法来打印结果或将其切换为整数。vartimeAtPress=NSDate()@IBActionfuncpressed(sender:AnyObject){println("pressed")timeAtPress=NSDate()}@IBActionfuncreleased(sender:AnyObject){println("released")varelapsedTime=NSDate.time

swift - 使用 Swift 查找 NSDates 之间的秒数差异作为整数

我正在编写一段代码,我想计算按下按钮的时间。为此,我在按下按钮时记录了一个NSDate(),并在释放按钮时尝试使用timeIntervalSinceDate函数。这似乎可行,但我找不到任何方法来打印结果或将其切换为整数。vartimeAtPress=NSDate()@IBActionfuncpressed(sender:AnyObject){println("pressed")timeAtPress=NSDate()}@IBActionfuncreleased(sender:AnyObject){println("released")varelapsedTime=NSDate.time