Я пытаюсь найти разницу между двумя NSDates.Это сработало один раз и напечатало разницу, но никогда больше не сработало.Я не помню, чтобы что-то менялось после того, как это сработало.Есть идеи?О, и это не выдает ошибку, и если я закомментирую этот фрагмент, все будет работать.
//----------- Touches Begin
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
touchBegins = [NSDate date];
NSLog (@" Tap: %d ", tapTotal);
NSLog (@"<=========================>");
NSLog (@"Method: touchesBegines & Ends");
NSLog (@" Touch Begin: %@", touchBegins);
// [self updateLabelsFromTouches:touches];
}
//----------- Touches End
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
touchEnds = [NSDate date];
NSLog (@" Touch Ends : %@", touchEnds );
@try {
NSLog(@"%@", touchEnds);
NSTimeInterval elapsed = [touchEnds timeIntervalSinceDate:touchBegins];
NSLog (@" Finger Down: %f", elapsed);
} @catch (NSException *ex) {}
NSLog (@" ");
[self updateLabelsFromTouches:touches];
}
Консоль:
[Session started at 2010-10-27 10:27:18 -0400.]
Tap: 0
<=========================>
Method: touchesBegines & Ends
Touch Begin: 2010-10-27 14:27:22 GMT
Touch Ends : 2010-10-27 14:27:22 GMT