project_files/HedgewarsMobile/Classes/HelpPageLobbyViewController.m
author antonc27 <antonc27@mail.ru>
Fri, 29 Dec 2017 22:35:36 +0100
branchios-develop
changeset 12870 350d8bde5ccd
parent 11122 2b4e89e5203b
child 12872 00215a7ec5f5
permissions -rw-r--r--
- Lazy checks for preventing crash when drawing 'nice hogs' on config screen (frontend) on iPad. Now we have animation glitch sometimes, but this is preferable to crash anyway
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11120
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     1
/*
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     2
 * Hedgewars-iOS, a Hedgewars port for iOS devices
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     3
 * Copyright (c) 2009-2012 Vittorio Giovara <vittorio.giovara@gmail.com>
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     4
 *
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     8
 *
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    12
 * GNU General Public License for more details.
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    13
 *
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    17
 */
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    18
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    19
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    20
#import "HelpPageLobbyViewController.h"
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    21
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    22
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    23
@implementation HelpPageLobbyViewController
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    24
@synthesize scrollView;
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    25
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    26
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation {
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    27
    return rotationManager(interfaceOrientation);
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    28
}
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    29
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    30
-(void) didReceiveMemoryWarning {
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    31
    [super didReceiveMemoryWarning];
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    32
    self.scrollView = nil;
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    33
}
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    34
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    35
// on iPhone the XIBs contain UIScrollView
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    36
-(void) viewDidLoad {
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    37
    if (IS_IPAD() == NO){
11121
182a42b79610 - HelpPageLobbyViewController updated: various UI fixes, autorotation fixes, help bubbles for iPad grouped
antonc27 <antonc27@mail.ru>
parents: 11120
diff changeset
    38
        scrollView.contentSize = CGSizeMake(self.view.frame.size.width, 650);
11120
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    39
        scrollView.maximumZoomScale = 4.0;
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    40
        scrollView.minimumZoomScale = 0.75;
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    41
        scrollView.clipsToBounds = YES;
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    42
        scrollView.delegate = self;
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    43
    }
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    44
    [super viewDidLoad];
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    45
}
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    46
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    47
-(void) viewDidUnload {
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    48
    [super viewDidUnload];
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    49
    self.scrollView = nil;
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    50
}
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    51
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    52
-(void) dealloc {
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    53
    releaseAndNil(scrollView);
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    54
    [super dealloc];
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    55
}
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    56
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    57
-(IBAction) dismiss {
11122
2b4e89e5203b - Fix for show/hide helpPage animations
antonc27 <antonc27@mail.ru>
parents: 11121
diff changeset
    58
    [UIView animateWithDuration:0.5 animations:^{
2b4e89e5203b - Fix for show/hide helpPage animations
antonc27 <antonc27@mail.ru>
parents: 11121
diff changeset
    59
        self.view.alpha = 0;
2b4e89e5203b - Fix for show/hide helpPage animations
antonc27 <antonc27@mail.ru>
parents: 11121
diff changeset
    60
    } completion:^(BOOL finished){
2b4e89e5203b - Fix for show/hide helpPage animations
antonc27 <antonc27@mail.ru>
parents: 11121
diff changeset
    61
        [self.view performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:0];
2b4e89e5203b - Fix for show/hide helpPage animations
antonc27 <antonc27@mail.ru>
parents: 11121
diff changeset
    62
    }];
11120
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    63
}
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    64
83c0d96f86ea - HelpPageLobbyViewController returned to project (back from 2012!), also help bubble images added
antonc27 <antonc27@mail.ru>
parents:
diff changeset
    65
@end