project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.m
author raptor <buckyballreaction@gmail.com>
Tue, 13 Aug 2019 13:10:12 -0600
changeset 15317 5b2dec63f4cf
parent 12877 00215a7ec5f5
permissions -rw-r--r--
Fix compiling on MacOS X by requiring c++11 standard. Building now requires MacOS X 10.8+ and CMake 3.9+
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