mirror of
https://github.com/zxing/zxing.git
synced 2025-01-13 04:07:27 -08:00
[iphone][ZXingWidgetController] delegate API changed to conform to standard delagate APIs, bug fixed regarding status bar displaying upon success of scanning
git-svn-id: https://zxing.googlecode.com/svn/trunk@1448 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
b94d44c5a1
commit
32bbefc1d2
|
@ -51,6 +51,6 @@
|
|||
@end
|
||||
|
||||
@protocol ZXingDelegate
|
||||
- (void)scanResult:(NSString *)result;
|
||||
- (void)cancelled;
|
||||
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)result;
|
||||
- (void)zxingControllerDidCancel:(ZXingWidgetController*)controller;
|
||||
@end
|
|
@ -78,6 +78,14 @@ CGImageRef UIGetScreenImage(void);
|
|||
}
|
||||
}
|
||||
|
||||
- (void)unloadImagePicker {
|
||||
if (self.imagePicker)
|
||||
{
|
||||
[imagePicker release];
|
||||
imagePicker = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (id)initWithDelegate:(id<ZXingDelegate>)scanDelegate showCancel:(BOOL)shouldShowCancel OneDMode:(BOOL)shouldUseoOneDMode {
|
||||
if (self = [super init]) {
|
||||
[self setDelegate:scanDelegate];
|
||||
|
@ -108,11 +116,10 @@ CGImageRef UIGetScreenImage(void);
|
|||
}
|
||||
|
||||
- (void)cancelled {
|
||||
NSLog(@"cancelled called in ZXingWidgetController");
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:NO];
|
||||
wasCancelled = true;
|
||||
wasCancelled = YES;
|
||||
if (delegate != nil) {
|
||||
[delegate cancelled];
|
||||
[delegate zxingControllerDidCancel:self];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,8 +136,8 @@ CGImageRef UIGetScreenImage(void);
|
|||
- (BOOL)fixedFocus {
|
||||
NSString *platform = [self getPlatform];
|
||||
if ([platform isEqualToString:@"iPhone1,1"] ||
|
||||
[platform isEqualToString:@"iPhone1,2"]) return true;
|
||||
return false;
|
||||
[platform isEqualToString:@"iPhone1,2"]) return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
|
@ -154,7 +161,7 @@ CGImageRef UIGetScreenImage(void);
|
|||
self.view = imagePicker.view;
|
||||
|
||||
[overlayView setPoints:nil];
|
||||
wasCancelled = false;
|
||||
wasCancelled = NO;
|
||||
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
|
||||
|
||||
[NSTimer scheduledTimerWithTimeInterval: FIRST_TAKE_DELAY
|
||||
|
@ -323,8 +330,9 @@ CGImageRef UIGetScreenImage(void);
|
|||
}
|
||||
|
||||
- (void)alertDelegate:(id)text {
|
||||
[[UIApplication sharedApplication] setStatusBarHidden:NO];
|
||||
if (delegate != nil) {
|
||||
[delegate scanResult:text];
|
||||
[delegate zxingController:self didScanResult:text];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue