[iphone] ScanTest was not displaying results on my device
authorrpechayr <rpechayr@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Sat, 22 May 2010 09:17:41 +0000 (09:17 +0000)
committerrpechayr <rpechayr@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Sat, 22 May 2010 09:17:41 +0000 (09:17 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@1386 59b500cc-1b3d-0410-9834-0bbf25fbcc57

iphone/ScanTest/Classes/RootViewController.h
iphone/ScanTest/Classes/RootViewController.m

index 8f1daa3..3a26d1b 100644 (file)
 @interface RootViewController : UIViewController <ZXingDelegate> {
        IBOutlet UITextView *resultsView;
        ZXingWidgetController *scanController;
+  NSString *resultsToDisplay;
 }
-@property (nonatomic, assign) IBOutlet UITextView *resultsView;
+@property (nonatomic, retain) IBOutlet UITextView *resultsView;
+@property (nonatomic, retain) NSString *resultsToDisplay;
 
 - (IBAction)scanPressed:(id)sender;
 @end
index 4851626..a9ae9a2 100644 (file)
@@ -11,7 +11,7 @@
 
 @implementation RootViewController
 @synthesize resultsView;
-
+@synthesize resultsToDisplay;
 #pragma mark -
 #pragma mark View lifecycle
 
@@ -19,8 +19,8 @@
     [super viewDidLoad];
        [self setTitle:@"ZXing"];
        scanController = [ZXingWidgetController alloc];
-       [scanController setOneDMode:false];
-       [scanController setShowCancel:true];
+       [scanController setOneDMode:NO];
+       [scanController setShowCancel:YES];
        scanController = [scanController initWithDelegate:self];
        NSBundle *mainBundle = [NSBundle mainBundle];
        [scanController setSoundToPlay:[[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO] retain]];
 #pragma mark Memory management
 
 - (void)scanResult:(NSString *)result {
-       [resultsView setText:result];
-       [self dismissModalViewControllerAnimated:true];
+       //[self.resultsView setText:result];
+       [self dismissModalViewControllerAnimated:NO];
+  self.resultsToDisplay = result;
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+  if (resultsToDisplay)
+  {
+    [resultsView setText:resultsToDisplay];
+    [resultsView setNeedsDisplay];
+  }
+  
 }
 
 - (void)cancelled {
@@ -88,7 +98,9 @@
 
 
 - (void)dealloc {
-       [scanController dealloc];
+  [resultsView release];
+       [scanController release];
+  [resultsToDisplay release];
     [super dealloc];
 }