On iPhone OS, -touchesEnded:withEvent: fires quickly when you left a finger, unless there was a drag. If -touchesMoved:withEvent: has fired, then there is about a 0.6 second delay before you get touchesEnded:withEvent:.
I verified this in a new project, no scrollView, no multi-touch.
I want the user to drag an object around, and then have a method 开发者_C百科fire as soon as he lifts a finger. The 0.6 second delay is unacceptable.
Any thoughts on dealing with this?
Edit: The only code I have written in the test project is this:
@implementation MyView
// startTime is an ivar
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
startTime = [NSDate timeIntervalSinceReferenceDate];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
NSLog(@"%f", [NSDate timeIntervalSinceReferenceDate] - startTime);
}
Found the problem: Magic Trackpad. When you run the Simulator, Magic Trackpad adds a delay before it decides that you have ended a touch.
精彩评论