/
NestViewController.m
67 lines (53 loc) · 2.06 KB
/
NestViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// NestViewController.m
// ViewDeckExample
//
#import "NestViewController.h"
#import "IIViewDeckController.h"
@implementation NestViewController
@synthesize level;
@synthesize levelLabel;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.level = 0;
}
return self;
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
self.levelLabel.text = [NSString stringWithFormat:@"Level %d", self.level];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
if (self.level == 1) {
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
self.viewDeckController.view.frame = [[UIScreen mainScreen] applicationFrame];
[self.viewDeckController.view setNeedsDisplay]; // .frame = self.viewDeckController.view.bounds;
}
}
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
if (self.level == 1) {
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
self.viewDeckController.view.frame = [[UIScreen mainScreen] applicationFrame];
[self.viewDeckController.view setNeedsDisplay]; // .frame = self.viewDeckController.view.bounds;
}
}
- (void)hideOrShow {
[[UIApplication sharedApplication] setStatusBarHidden:![UIApplication sharedApplication].isStatusBarHidden withAnimation:UIStatusBarAnimationSlide];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (IBAction)pressedGoDeeper:(id)sender {
NestViewController* nestController = [[NestViewController alloc] initWithNibName:@"NestViewController" bundle:nil];
nestController.level = self.level + 1;
[self.navigationController pushViewController:nestController animated:YES];
}
@end