project_files/HedgewarsMobile/Classes/HoldTableViewCell.m
branchios-revival
changeset 11135 b34c0e2b546a
parent 10108 c68cf030eded
child 11252 3dc674af7662
equal deleted inserted replaced
11134:41cfa8edf02f 11135:b34c0e2b546a
    55         [super touchesCancelled:touches withEvent:event];
    55         [super touchesCancelled:touches withEvent:event];
    56 }
    56 }
    57 
    57 
    58 -(void) holdAction {
    58 -(void) holdAction {
    59     if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:onTable:)])
    59     if (self.delegate != nil && [self.delegate respondsToSelector:@selector(holdAction:onTable:)])
    60         [self.delegate holdAction:self.textLabel.text onTable:(UITableView *)self.superview];
    60     {
       
    61         UITableView *tableView = [self findTable];
       
    62         if (tableView)
       
    63         {
       
    64             [self.delegate holdAction:self.textLabel.text onTable:tableView];
       
    65         }
       
    66     }
       
    67 }
       
    68 
       
    69 - (UITableView *)findTable
       
    70 {
       
    71     UIView *tableView = self.superview;
       
    72     while (![tableView isKindOfClass:[UITableView class]] || (tableView == nil))
       
    73     {
       
    74         tableView = tableView.superview;
       
    75         
       
    76         if ([tableView isEqual:self.window])
       
    77         {
       
    78             tableView = nil;
       
    79         }
       
    80     }
       
    81     
       
    82     return (UITableView *)tableView;
    61 }
    83 }
    62 
    84 
    63 -(void) dealloc {
    85 -(void) dealloc {
    64     self.delegate = nil;
    86     self.delegate = nil;
    65     [super dealloc];
    87     [super dealloc];