project_files/HedgewarsMobile/Classes/UITableViewCell+FindTable.m
author unc0rr
Mon, 13 Nov 2017 21:16:52 +0100
changeset 12835 71cdc02ccca6
parent 11252 3dc674af7662
permissions -rw-r--r--
- More files to ignore - Remove ancient kdevelop project file
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