سؤال

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.

هل كانت مفيدة؟

المحلول

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

CFAbsoluteTime time = [[tapTimes objectAtIndex:…] doubleValue];
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top