Domanda

I want to store CFAbsoluteTime in NSMutablearray. Can I add like this ?

CFAbsoluteTime time = CFAbsoluteTimeGetCurrent();
[tapTimes addObject:[NSNumber numberWithDouble:(double)time]];

If so, after I store that, I need to retrieve that one and convert to CFAbsoluteTime for later calculation. I would like to know how to do.

È stato utile?

Soluzione

Your approach is correct. To get the value back as a CFAbsoluteTime, do:

CFAbsoluteTime time = [[tapTimes objectAtIndex:…] doubleValue];
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top