mirror of
https://github.com/zxing/zxing.git
synced 2025-01-12 19:57:27 -08:00
[iphone][ScanTest] updated after update of ZingWidgetController
git-svn-id: https://zxing.googlecode.com/svn/trunk@1449 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
32bbefc1d2
commit
211b24a454
|
@ -11,7 +11,6 @@
|
|||
|
||||
@interface RootViewController : UIViewController <ZXingDelegate> {
|
||||
IBOutlet UITextView *resultsView;
|
||||
ZXingWidgetController *scanController;
|
||||
NSString *resultsToDisplay;
|
||||
}
|
||||
@property (nonatomic, retain) IBOutlet UITextView *resultsView;
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
#import "RootViewController.h"
|
||||
#import "QRCodeReader.h"
|
||||
|
||||
|
||||
@interface RootViewController()
|
||||
@property (nonatomic,retain) ZXingWidgetController *scanController;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -18,73 +18,32 @@
|
|||
@implementation RootViewController
|
||||
@synthesize resultsView;
|
||||
@synthesize resultsToDisplay;
|
||||
@synthesize scanController;
|
||||
#pragma mark -
|
||||
#pragma mark View lifecycle
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[super viewDidLoad];
|
||||
[self setTitle:@"ZXing"];
|
||||
|
||||
}
|
||||
|
||||
- (IBAction)scanPressed:(id)sender {
|
||||
|
||||
ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO];
|
||||
QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init];
|
||||
NSSet *readers = [[NSSet alloc ] initWithObjects:qrcodeReader,nil];
|
||||
[qrcodeReader release];
|
||||
widController.readers = readers;
|
||||
[readers release];
|
||||
|
||||
self.scanController = widController;
|
||||
[widController release];
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
[scanController setSoundToPlay:[[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO] retain]];
|
||||
|
||||
}
|
||||
|
||||
- (IBAction)scanPressed:(id)sender {
|
||||
//UIImagePickerController *picker = [[UIImagePickerController alloc] init];
|
||||
[self presentModalViewController:scanController
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
[widController setSoundToPlay:[[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO] retain]];
|
||||
[self presentModalViewController:widController
|
||||
animated:YES];
|
||||
// [self.navigationController pushViewController:scanController animated:true];
|
||||
[widController release];
|
||||
}
|
||||
|
||||
/*
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
}
|
||||
*/
|
||||
/*
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
}
|
||||
*/
|
||||
/*
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
}
|
||||
*/
|
||||
/*
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Override to allow orientations other than the default portrait orientation.
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
// Return YES for supported orientations.
|
||||
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
||||
}
|
||||
*/
|
||||
|
||||
#pragma mark Memory management
|
||||
|
||||
- (void)scanResult:(NSString *)result {
|
||||
//[self.resultsView setText:result];
|
||||
[self dismissModalViewControllerAnimated:NO];
|
||||
self.resultsToDisplay = result;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
if (resultsToDisplay)
|
||||
{
|
||||
[resultsView setText:resultsToDisplay];
|
||||
|
@ -92,31 +51,63 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)cancelled {
|
||||
[self dismissModalViewControllerAnimated:YES];
|
||||
/*
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
}
|
||||
*/
|
||||
/*
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
[super viewWillDisappear:animated];
|
||||
}
|
||||
*/
|
||||
/*
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
[super viewDidDisappear:animated];
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Override to allow orientations other than the default portrait orientation.
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
// Return YES for supported orientations.
|
||||
return (interfaceOrientation == UIInterfaceOrientationPortrait);
|
||||
}
|
||||
*/
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark ZXingDelegateMethods
|
||||
|
||||
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)result {
|
||||
[self dismissModalViewControllerAnimated:NO];
|
||||
self.resultsToDisplay = result;
|
||||
}
|
||||
|
||||
- (void)zxingControllerDidCancel:(ZXingWidgetController*)controller {
|
||||
[self dismissModalViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Memory management
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Relinquish ownership any cached data, images, etc that aren't in use.
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Relinquish ownership any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
|
||||
// For example: self.myOutlet = nil;
|
||||
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
|
||||
// For example: self.myOutlet = nil;
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[resultsView release];
|
||||
[scanController release];
|
||||
[resultsToDisplay release];
|
||||
[super dealloc];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -118,8 +118,8 @@
|
|||
080E96DDFE201D6D7F000001 /* Classes */,
|
||||
29B97315FDCFA39411CA2CEA /* Other Sources */,
|
||||
29B97317FDCFA39411CA2CEA /* Resources */,
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */,
|
||||
1F027F6D11A7BAB1006B06DE /* Dependencies */,
|
||||
29B97323FDCFA39411CA2CEA /* Frameworks */,
|
||||
19C28FACFE9D520D11CA2CBB /* Products */,
|
||||
);
|
||||
name = CustomTemplate;
|
||||
|
|
Loading…
Reference in a new issue