diff --git a/ios/AlmaZBarReaderViewController.h b/ios/AlmaZBarReaderViewController.h new file mode 100644 index 0000000..4eb14a6 --- /dev/null +++ b/ios/AlmaZBarReaderViewController.h @@ -0,0 +1,13 @@ +// +// AlmaZBarReaderViewController.h +// BarCodeMix +// +// Created by eCompliance on 23/01/15. +// +// + +#import "ZBarReaderViewController.h" + +@interface AlmaZBarReaderViewController : ZBarReaderViewController + +@end diff --git a/ios/AlmaZBarReaderViewController.m b/ios/AlmaZBarReaderViewController.m new file mode 100644 index 0000000..9144939 --- /dev/null +++ b/ios/AlmaZBarReaderViewController.m @@ -0,0 +1,41 @@ +// +// AlmaZBarReaderViewController.m +// BarCodeMix +// +// Created by eCompliance on 23/01/15. +// +// + +#import "AlmaZBarReaderViewController.h" + +@interface AlmaZBarReaderViewController () + +@end + +@implementation AlmaZBarReaderViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +-(BOOL)shouldAutorotate{ + return NO; +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/ios/CsZBar.m b/ios/CsZBar.m index a24f891..6b7dc9f 100644 --- a/ios/CsZBar.m +++ b/ios/CsZBar.m @@ -1,12 +1,12 @@ #import "CsZBar.h" - +#import "AlmaZBarReaderViewController.h" #pragma mark - State @interface CsZBar () @property bool scanInProgress; @property NSString *scanCallbackId; -@property ZBarReaderViewController *scanReader; +@property AlmaZBarReaderViewController *scanReader; @end @@ -40,10 +40,10 @@ } else { self.scanInProgress = YES; self.scanCallbackId = [command callbackId]; - self.scanReader = [ZBarReaderViewController new]; + self.scanReader = [AlmaZBarReaderViewController new]; self.scanReader.readerDelegate = self; - self.scanReader.supportedOrientationsMask = ZBarOrientationMaskAll; + self.scanReader.supportedOrientationsMask = ZBarOrientationMask(UIInterfaceOrientationPortrait); // Get user parameters NSDictionary *params = (NSDictionary*) [command argumentAtIndex:0]; @@ -70,12 +70,12 @@ CGFloat screenWidth = screenRect.size.width; CGFloat screenHeight = screenRect.size.height; CGFloat dim = screenWidth < screenHeight ? screenWidth / 1.1 : screenHeight / 1.1; - UIView *polygonView = [[UIView alloc] initWithFrame: CGRectMake ( 0, 0, dim, dim)]; - polygonView.center = self.scanReader.view.center; - polygonView.layer.borderColor = [UIColor greenColor].CGColor; - polygonView.layer.borderWidth = 3.0f; + UIView *polygonView = [[UIView alloc] initWithFrame: CGRectMake ( (screenWidth/2) - (dim/2), (screenHeight/2) - (dim/2), dim, dim)]; + //polygonView.center = self.scanReader.view.center; + //polygonView.layer.borderColor = [UIColor greenColor].CGColor; + //polygonView.layer.borderWidth = 3.0f; - UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, dim / 2, dim, 1)]; + UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(dim / 2, 0, 1, dim)]; lineView.backgroundColor = [UIColor redColor]; [polygonView addSubview:lineView];