/
NestViewController.m
44 lines (33 loc) · 1.03 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
//
// NestViewController.m
// ViewDeckExample
//
#import "NestViewController.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];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)pressedGoDeeper:(id)sender {
NestViewController* nestController = [[NestViewController alloc] initWithNibName:@"NestViewController" bundle:nil];
nestController.level = self.level + 1;
[self.navigationController pushViewController:nestController animated:YES];
}
@end