Last active
December 16, 2015 14:49
-
-
Save yannickl/5451597 to your computer and use it in GitHub Desktop.
Here a little comparison between ZXing and ZBar in the point of view of the developer.
The most important things is that ZXing is compiled using the Objective-C++ compiler (.mm) whereas ZBar is purely compile using the Objective-C compiler (.m).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#import "ZBarSDK.h" | |
@interface ZBarTest : NSObject <ZBarReaderDelegate> | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ZBarTest.h" | |
@implementation ZBarTest | |
- (void)scan | |
{ | |
ZBarReaderViewController *reader = [ZBarReaderViewController new]; | |
reader.readerDelegate = self; | |
reader.supportedOrientationsMask = ZBarOrientationMaskAll; | |
ZBarImageScanner *scanner = reader.scanner; | |
[scanner setSymbology:ZBAR_I25 config:ZBAR_CFG_ENABLE to:0]; | |
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentModalViewController:reader animated:YES]; | |
} | |
#pragma mark - | |
#pragma mark ZBar Delegate Methods | |
- (void)imagePickerController:(UIImagePickerController *)reader didFinishPickingMediaWithInfo:(NSDictionary *) info | |
{ | |
[[[[UIApplication sharedApplication] keyWindow] rootViewController] dismissModalViewControllerAnimated:YES]; | |
[[UIApplication sharedApplication] setStatusBarHidden:YES]; | |
id<NSFastEnumeration> results = [info objectForKey:ZBarReaderControllerResults]; | |
ZBarSymbol *symbol = nil; | |
for(symbol in results) | |
break; | |
if (symbol) { | |
NSString *result = symbol.data; | |
NSLog(@"Result: %@", result); | |
} | |
} | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <UIKit/UIKit.h> | |
#import "ZXingWidgetController.h" | |
@interface ZXingTest : NSObject <ZXingDelegate> | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ZXingTest.h" | |
#import "QRCodeReader.h" | |
@implementation ZXingTest | |
- (void)scan | |
{ | |
QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init]; | |
NSSet *readers = [[NSSet alloc] initWithObjects:qrcodeReader, nil]; | |
ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO]; | |
widController.readers = readers; | |
[[[[UIApplication sharedApplication] keyWindow] rootViewController] presentModalViewController:widController animated:YES]; | |
} | |
#pragma mark - | |
#pragma mark ZXing Delegate Methods | |
- (void)zxingController:(ZXingWidgetController *)controller didScanResult:(NSString *)result | |
{ | |
[[[[UIApplication sharedApplication] keyWindow] rootViewController] dismissModalViewControllerAnimated:YES]; | |
[[UIApplication sharedApplication] setStatusBarHidden:YES]; | |
NSLog(@"Result: %@", result); | |
} | |
- (void)zxingControllerDidCancel:(ZXingWidgetController *)controller | |
{ | |
[[[[UIApplication sharedApplication] keyWindow] rootViewController] dismissModalViewControllerAnimated:YES]; | |
[[UIApplication sharedApplication] setStatusBarHidden:YES]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment