project_files/HedgewarsMobile/Classes/HoldTableViewCell.m
changeset 8441 a00b0fa0dbd7
parent 6832 fae8fd118da9
child 10108 c68cf030eded
equal deleted inserted replaced
8440:ea4d6a7a2937 8441:a00b0fa0dbd7
    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