the very simple test app that calls the ZXingWidget
[zxing.git] / iphone / ScanTest / Classes / RootViewController.m
1 //
2 //  RootViewController.m
3 //  ScanTest
4 //
5 //  Created by David Kavanagh on 5/10/10.
6 //  Copyright __MyCompanyName__ 2010. All rights reserved.
7 //
8
9 #import "RootViewController.h"
10
11
12 @implementation RootViewController
13 @synthesize resultsView;
14
15 #pragma mark -
16 #pragma mark View lifecycle
17
18 - (void)viewDidLoad {
19     [super viewDidLoad];
20         [self setTitle:@"ZXing"];
21         scanController = [[ZXingWidgetController alloc] initWithDelegate:self];
22 }
23
24 - (IBAction)scanPressed:(id)sender {
25         [self presentModalViewController:scanController animated:YES];
26 //      [self.navigationController pushViewController:scanController animated:true];
27 }
28
29 /*
30 - (void)viewWillAppear:(BOOL)animated {
31     [super viewWillAppear:animated];
32 }
33 */
34 /*
35 - (void)viewDidAppear:(BOOL)animated {
36     [super viewDidAppear:animated];
37 }
38 */
39 /*
40 - (void)viewWillDisappear:(BOOL)animated {
41         [super viewWillDisappear:animated];
42 }
43 */
44 /*
45 - (void)viewDidDisappear:(BOOL)animated {
46         [super viewDidDisappear:animated];
47 }
48 */
49
50 /*
51  // Override to allow orientations other than the default portrait orientation.
52 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
53         // Return YES for supported orientations.
54         return (interfaceOrientation == UIInterfaceOrientationPortrait);
55 }
56  */
57
58 #pragma mark Memory management
59
60 - (void)scanResult:(ParsedResult *)result {
61         [resultsView setText:[result stringForDisplay]];
62         [self dismissModalViewControllerAnimated:true];
63 }
64
65 - (void)cancelled {
66         [self dismissModalViewControllerAnimated:true];
67 }
68
69 #pragma mark -
70 #pragma mark Memory management
71
72 - (void)didReceiveMemoryWarning {
73     // Releases the view if it doesn't have a superview.
74     [super didReceiveMemoryWarning];
75     
76     // Relinquish ownership any cached data, images, etc that aren't in use.
77 }
78
79 - (void)viewDidUnload {
80     // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
81     // For example: self.myOutlet = nil;
82 }
83
84
85 - (void)dealloc {
86         [scanController dealloc];
87     [super dealloc];
88 }
89
90
91 @end
92