2 // RootViewController.m
5 // Created by David Kavanagh on 5/10/10.
6 // Copyright __MyCompanyName__ 2010. All rights reserved.
9 #import "RootViewController.h"
12 @implementation RootViewController
13 @synthesize resultsView;
16 #pragma mark View lifecycle
20 [self setTitle:@"ZXing"];
21 scanController = [[ZXingWidgetController alloc] initWithDelegate:self];
24 - (IBAction)scanPressed:(id)sender {
25 [self presentModalViewController:scanController animated:YES];
26 // [self.navigationController pushViewController:scanController animated:true];
30 - (void)viewWillAppear:(BOOL)animated {
31 [super viewWillAppear:animated];
35 - (void)viewDidAppear:(BOOL)animated {
36 [super viewDidAppear:animated];
40 - (void)viewWillDisappear:(BOOL)animated {
41 [super viewWillDisappear:animated];
45 - (void)viewDidDisappear:(BOOL)animated {
46 [super viewDidDisappear:animated];
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);
58 #pragma mark Memory management
60 - (void)scanResult:(ParsedResult *)result {
61 [resultsView setText:[result stringForDisplay]];
62 [self dismissModalViewControllerAnimated:true];
66 [self dismissModalViewControllerAnimated:true];
70 #pragma mark Memory management
72 - (void)didReceiveMemoryWarning {
73 // Releases the view if it doesn't have a superview.
74 [super didReceiveMemoryWarning];
76 // Relinquish ownership any cached data, images, etc that aren't in use.
79 - (void)viewDidUnload {
80 // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
81 // For example: self.myOutlet = nil;
86 [scanController dealloc];