project_files/HedgewarsMobile/Classes/GameLogViewController.m
branchios-revival
changeset 11180 906c1878bc2c
child 11181 015596575698
equal deleted inserted replaced
11179:e1a098f950a9 11180:906c1878bc2c
       
     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 "GameLogViewController.h"
       
    20 
       
    21 @interface GameLogViewController ()
       
    22 
       
    23 @end
       
    24 
       
    25 @implementation GameLogViewController
       
    26 
       
    27 #pragma mark - View life cycle
       
    28 
       
    29 - (void)viewDidLoad
       
    30 {
       
    31     [super viewDidLoad];
       
    32     
       
    33     UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithTitle:@"Close" style:UIBarButtonItemStylePlain target:self action:@selector(dismissAction)];
       
    34     self.navigationItem.rightBarButtonItem = closeButton;
       
    35     [closeButton release];
       
    36     
       
    37     NSString *debugStr = nil;
       
    38     if ([[NSFileManager defaultManager] fileExistsAtPath:DEBUG_FILE()])
       
    39         debugStr = [[NSString alloc] initWithContentsOfFile:DEBUG_FILE() encoding:NSUTF8StringEncoding error:nil];
       
    40     else
       
    41         debugStr = [[NSString alloc] initWithString:@"Here be log"];
       
    42     
       
    43     UITextView *logView = [[UITextView alloc] initWithFrame:self.view.frame];
       
    44     [logView setAutoresizingMask:(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth)];
       
    45     logView.text = debugStr;
       
    46     [debugStr release];
       
    47     logView.editable = NO;
       
    48     
       
    49     [self.view addSubview:logView];
       
    50     [logView release];
       
    51 }
       
    52 
       
    53 #pragma mark - Actions
       
    54 
       
    55 - (void)dismissAction
       
    56 {
       
    57     [self dismissViewControllerAnimated:YES completion:nil];
       
    58 }
       
    59 
       
    60 #pragma mark - Memory warning
       
    61 
       
    62 - (void)didReceiveMemoryWarning
       
    63 {
       
    64     [super didReceiveMemoryWarning];
       
    65     // Dispose of any resources that can be recreated.
       
    66 }
       
    67 
       
    68 @end