RootViewController.m
1.15 KB
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
//
// RootViewController.m
// MapMemoryLeaksCheck
//
// Created by Thomas Rasch on 11.10.11.
// Copyright (c) 2011 Alpstein. All rights reserved.
//
#import "RootViewController.h"
#import "MapViewController.h"
@implementation RootViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
if (!(self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
return nil;
return self;
}
- (void)loadView
{
[super loadView];
CGRect bounds = self.view.bounds;
UIButton *showMapButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
showMapButton.frame = CGRectMake(10.0, bounds.size.height - 100.0, bounds.size.width-20.0, 44.0);
[showMapButton setTitle:@"Show the map" forState:UIControlStateNormal];
[showMapButton addTarget:self action:@selector(showTheMap) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:showMapButton];
}
- (void)showTheMap
{
MapViewController *mapViewController = [[[MapViewController alloc] initWithNibName:nil bundle:nil] autorelease];
[self.navigationController pushViewController:mapViewController animated:YES];
}
@end