如何将NSTimeInterval值转换为NSData

最佳答案

您也可以使用NSKeyedArchiver

    let time = NSTimeInterval(100)

    let archivedTime = NSKeyedArchiver.archivedDataWithRootObject(time)
    let unarchivedTime = NSKeyedUnarchiver.unarchiveObjectWithData(archivedTime) as! NSTimeInterval

关于swift - 将NSTimeInterval转换为NSData并返回到NSTimeInterval,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33653208/

10-10 08:31