Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[iphone][ZXingWidgetController] delegate API changed to conform to st…

…andard delagate APIs, bug fixed regarding status bar displaying upon success of scanning
  • Loading branch information...
commit 66f2aee22c8b635649963a29edbaa03eaf95d6a1 1 parent aed4450
rpechayr authored
View
4 iphone/ZXingWidget/Classes/ZXingWidgetController.h
@@ -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
View
22 iphone/ZXingWidget/Classes/ZXingWidgetController.m
@@ -78,6 +78,14 @@ -(void)loadImagePicker {
}
}
+- (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 @@ - (void)dealloc {
}
- (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 @@ - (NSString *)getPlatform {
- (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 @@ - (void)viewDidAppear:(BOOL)animated {
self.view = imagePicker.view;
[overlayView setPoints:nil];
- wasCancelled = false;
+ wasCancelled = NO;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
[NSTimer scheduledTimerWithTimeInterval: FIRST_TAKE_DELAY
@@ -323,8 +330,9 @@ - (void)decoder:(Decoder *)decoder didDecodeImage:(UIImage *)image usingSubset:(
}
- (void)alertDelegate:(id)text {
+ [[UIApplication sharedApplication] setStatusBarHidden:NO];
if (delegate != nil) {
- [delegate scanResult:text];
+ [delegate zxingController:self didScanResult:text];
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.