project_files/HedgewarsMobile/Classes/TableViewControllerWithDoneButton.m
branchios-revival
changeset 11217 e68b3e392091
child 12872 00215a7ec5f5
equal deleted inserted replaced
11216:76fd61a88c1e 11217:e68b3e392091
       
     1 /*
       
     2  * Hedgewars-iOS, a Hedgewars port for iOS devices
       
     3  * Copyright (c) 2015 Anton Malmygin <antonc27@mail.ru>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
       
    17  */
       
    18 
       
    19 #import "TableViewControllerWithDoneButton.h"
       
    20 
       
    21 @interface TableViewControllerWithDoneButton ()
       
    22 
       
    23 @end
       
    24 
       
    25 @implementation TableViewControllerWithDoneButton
       
    26 
       
    27 - (void)viewDidLoad
       
    28 {
       
    29     [super viewDidLoad];
       
    30     
       
    31     if (!IS_IPAD())
       
    32     {
       
    33         UIBarButtonItem *doneButton = [self doneButton];
       
    34         self.navigationItem.backBarButtonItem = doneButton;
       
    35         self.navigationItem.leftBarButtonItem = doneButton;
       
    36     }
       
    37 }
       
    38 
       
    39 - (UIBarButtonItem *)doneButton
       
    40 {
       
    41     return [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone
       
    42                                                           target:self
       
    43                                                           action:@selector(dismissView)] autorelease];
       
    44 }
       
    45 
       
    46 - (void)dismissView
       
    47 {
       
    48     [[AudioManagerController mainManager] playBackSound];
       
    49     [[[HedgewarsAppDelegate sharedAppDelegate] mainViewController] dismissViewControllerAnimated:YES completion:nil];
       
    50 }
       
    51 
       
    52 @end