Added beep. Settable sound file location via widget property. Client app sets this.
[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         NSBundle *mainBundle = [NSBundle mainBundle];
23         [scanController setSoundToPlay:[[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO] retain]];
24 }
25
26 - (IBAction)scanPressed:(id)sender {
27         [self presentModalViewController:scanController animated:YES];
28 //      [self.navigationController pushViewController:scanController animated:true];
29 }
30
31 /*
32 - (void)viewWillAppear:(BOOL)animated {
33     [super viewWillAppear:animated];
34 }
35 */
36 /*
37 - (void)viewDidAppear:(BOOL)animated {
38     [super viewDidAppear:animated];
39 }
40 */
41 /*
42 - (void)viewWillDisappear:(BOOL)animated {
43         [super viewWillDisappear:animated];
44 }
45 */
46 /*
47 - (void)viewDidDisappear:(BOOL)animated {
48         [super viewDidDisappear:animated];
49 }
50 */
51
52 /*
53  // Override to allow orientations other than the default portrait orientation.
54 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
55         // Return YES for supported orientations.
56         return (interfaceOrientation == UIInterfaceOrientationPortrait);
57 }
58  */
59
60 #pragma mark Memory management
61
62 - (void)scanResult:(NSString *)result {
63         [resultsView setText:result];
64         [self dismissModalViewControllerAnimated:true];
65 }
66
67 - (void)cancelled {
68         [self dismissModalViewControllerAnimated:true];
69 }
70
71 #pragma mark -
72 #pragma mark Memory management
73
74 - (void)didReceiveMemoryWarning {
75     // Releases the view if it doesn't have a superview.
76     [super didReceiveMemoryWarning];
77     
78     // Relinquish ownership any cached data, images, etc that aren't in use.
79 }
80
81 - (void)viewDidUnload {
82     // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
83     // For example: self.myOutlet = nil;
84 }
85
86
87 - (void)dealloc {
88         [scanController dealloc];
89     [super dealloc];
90 }
91
92
93 @end
94