project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.m
author Wuzzy <Wuzzy2@mail.ru>
Sat, 30 Nov 2019 02:54:49 +0100
changeset 15514 6ddfde71ba6a
parent 12877 00215a7ec5f5
permissions -rw-r--r--
Remove parachute early if hog is inside land Fixes a bug: When you used parachute right after using a parachute to dig inside land, you might become stuck. Reported here: https://hedgewars.org/node/9035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     1
/*
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     3
 * Copyright (c) 2015 Anton Malmygin <antonc27@mail.ru>
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     4
 *
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     8
 *
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    13
 *
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    17
 */
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    18
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    19
#import "TableViewControllerWithDoneButton.h"
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    20
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    21
@interface TableViewControllerWithDoneButton ()
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    22
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    23
@end
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    24
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    25
@implementation TableViewControllerWithDoneButton
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    26
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    27
- (void)viewDidLoad
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    28
{
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    29
    [super viewDidLoad];
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    30
    
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    31
    if (!IS_IPAD())
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    32
    {
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    33
        UIBarButtonItem *doneButton = [self doneButton];
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    34
        self.navigationItem.backBarButtonItem = doneButton;
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    35
        self.navigationItem.leftBarButtonItem = doneButton;
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    36
    }
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    37
}
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    38
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    39
- (UIBarButtonItem *)doneButton
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    40
{
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    41
    return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    42
                                                          target:self
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    43
                                                          action:@selector(dismissView)];
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    44
}
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    45
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    46
- (void)dismissView
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    47
{
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    48
    [[AudioManagerController mainManager] playBackSound];
12877
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    49
    UIViewController *vc = [[HedgewarsAppDelegate sharedAppDelegate] mainViewController];
00215a7ec5f5 - BIG CHANGE: Convert iOS project to use ARC
antonc27 <antonc27@mail.ru>
parents: 11221
diff changeset
    50
    [vc dismissViewControllerAnimated:YES completion:nil];
11221
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    51
}
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    52
e68b3e392091 - Big refactoring of front-end Settings for both iPhone and iPad:
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    53
@end