project_files/HedgewarsMobile/Classes/UITableViewCell+FindTable.m
author Wuzzy <almikes@aol.com>
Wed, 11 Oct 2017 23:01:07 +0200
changeset 12692 cb6b70392459
parent 11252 3dc674af7662
permissions -rw-r--r--
Keep rope/jetpack/parachute selected when destroyed and having secondary ammo selected Assumption: You rope with secondary ammo selected. You miss a shot, destroying the rope gear. Previous behaviour: Rope gets deselected and the secondary ammo gets selected, you can no longer rope. Very annoying, reason of many Shoppa fails! New behaviour: Rope stays selected, but selection of secondary ammo is cleared (because rope gear got destroyed). Makes much more sense overall. Analog for jetpack and parachute.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11252
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     1
/*
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     3
 * Copyright (c) 2015 Anton Malmygin <antonc27@mail.ru>
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     4
 *
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     8
 *
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    13
 *
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    17
 */
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    18
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    19
#import "UITableViewCell+FindTable.h"
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    20
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    21
@implementation UITableViewCell (FindTable)
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    22
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    23
- (UITableView *)findTable
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    24
{
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    25
    UIView *tableView = self.superview;
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    26
    while (![tableView isKindOfClass:[UITableView class]] || (tableView == nil))
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    27
    {
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    28
        tableView = tableView.superview;
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    29
        
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    30
        if ([tableView isEqual:self.window])
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    31
        {
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    32
            tableView = nil;
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    33
        }
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    34
    }
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    35
    
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    36
    return (UITableView *)tableView;
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    37
}
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    38
3dc674af7662 - FindTable functionality for HoldTableViewCell and EditableCellView extracted to category
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    39
@end