equal
deleted
inserted
replaced
33 return self; |
33 return self; |
34 } |
34 } |
35 |
35 |
36 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { |
36 -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { |
37 UITouch *touch = [[event allTouches] anyObject]; |
37 UITouch *touch = [[event allTouches] anyObject]; |
38 |
38 |
39 time = touch.timestamp; |
39 time = touch.timestamp; |
40 [self performSelector:@selector(holdAction) withObject:nil afterDelay:0.25]; |
40 [self performSelector:@selector(holdAction) withObject:nil afterDelay:0.25]; |
41 |
41 |
42 [super touchesBegan:touches withEvent:event]; |
42 [super touchesBegan:touches withEvent:event]; |
43 } |
43 } |
44 |
44 |
45 -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { |
45 -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { |
46 UITouch *touch = [[event allTouches] anyObject]; |
46 UITouch *touch = [[event allTouches] anyObject]; |
47 |
47 |
48 if ( touch.timestamp - time < 0.25 ) { |
48 if ( touch.timestamp - time < 0.25 ) { |
49 [NSObject cancelPreviousPerformRequestsWithTarget:self |
49 [NSObject cancelPreviousPerformRequestsWithTarget:self |
50 selector:@selector(holdAction) |
50 selector:@selector(holdAction) |
51 object:nil]; |
51 object:nil]; |
52 |
52 |
53 [super touchesEnded:touches withEvent:event]; |
53 [super touchesEnded:touches withEvent:event]; |
54 } else |
54 } else |
55 [super touchesCancelled:touches withEvent:event]; |
55 [super touchesCancelled:touches withEvent:event]; |
56 } |
56 } |
57 |
57 |