我需要记录时间(毫秒)。当单击button1时,计时器将启动。当单击button2时,计时器将停止。我需要在标签中显示时间间隔(毫秒)。对不起,我是IOS新来的。
发布于 2014-05-04 15:42:13
在类的.h文件中
@interface MyClass
{
NSDate *_start;
}单击第一个UILabel时,请执行以下操作:
// start is an attribute of your class of type NSDate.
_start = [NSDate date];当第二个按钮被点击时:
if (_start)
NSTimeInterval timeInterval = [_start timeIntervalSinceNow];timeInterval为您提供了_start和now之间毫秒的差异。
https://stackoverflow.com/questions/23457847
复制相似问题