This commit is contained in:
Daniel Cousens 2016-07-29 11:06:46 +10:00 committed by GitHub
parent 843b432d56
commit 7995df9dc8

View File

@ -3,8 +3,6 @@
// BarCodeMix // BarCodeMix
// //
// Created by eCompliance on 23/01/15. // Created by eCompliance on 23/01/15.
//
//
#import "AlmaZBarReaderViewController.h" #import "AlmaZBarReaderViewController.h"
#import "CsZbar.h" #import "CsZbar.h"
@ -15,7 +13,6 @@
@implementation AlmaZBarReaderViewController @implementation AlmaZBarReaderViewController
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
@ -25,31 +22,21 @@
CGRect screenRect = [[UIScreen mainScreen] bounds]; CGRect screenRect = [[UIScreen mainScreen] bounds];
//[button setContentEdgeInsets:UIEdgeInsetsMake(20, 30, 20, 30)]; //[button setContentEdgeInsets:UIEdgeInsetsMake(20, 30, 20, 30)];
CGRect frame; CGRect frame;
if(screenRect.size.height>(screenRect.size.width)){
frame = CGRectMake(0,0, screenRect.size.width*(0.15), screenRect.size.height*0.15);
//button.center = CGPointMake( 0,0); if (screenRect.size.height > (screenRect.size.width)) {
frame = CGRectMake(0,0, screenRect.size.width*(0.15), screenRect.size.height*0.15);
}else{ }else{
frame = CGRectMake(0,0, screenRect.size.width*(0.10), screenRect.size.height*0.20); frame = CGRectMake(0,0, screenRect.size.width*(0.10), screenRect.size.height*0.20);
//button.center = CGPointMake(0,0);
} }
button.frame =frame; button.frame =frame;
button.layer.cornerRadius = 10; button.layer.cornerRadius = 10;
button.clipsToBounds = YES; button.clipsToBounds = YES;
// Set a new (x,y) point for the button's center
//[button setBackgroundColor:[UIColor colorWithRed:.859 green:.765 blue:.616 alpha:1.0] forState:UIControlStateHighlighted];
//button.center = CGPointMake( 0,0);
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button]; [self.view addSubview:button];
} }
- (BOOL)prefersStatusBarHidden { - (BOOL)prefersStatusBarHidden {
return YES; return YES;
} }
@ -58,49 +45,35 @@
[super didReceiveMemoryWarning]; [super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. // Dispose of any resources that can be recreated.
} }
//Techedge Changes NSS fase 2 //Techedge Changes NSS fase 2
- (void)buttonPressed: (UIButton *) button { - (void)buttonPressed: (UIButton *) button {
CsZBar *obj = [[CsZBar alloc] init]; CsZBar *obj = [[CsZBar alloc] init];
[obj toggleflash]; [obj toggleflash];
} }
- (BOOL)shouldAutorotate{ - (BOOL)shouldAutorotate{
return YES; return YES;
} }
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
//AlmaZBarReaderViewController.scanner.scanner.cameraOverlayView = poli - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation) fromInterfaceOrientation {
//NSDictionary *params = (NSDictionary*) [command argumentAtIndex:0]; // AlmaZBarReaderViewController.scanner.scanner.cameraOverlayView = poli
// NSDictionary *params = (NSDictionary*) [command argumentAtIndex:0];
BOOL drawSight = true;//[params objectForKey:@"drawSight"] ? [[params objectForKey:@"drawSight"] boolValue] : true; BOOL drawSight = true;//[params objectForKey:@"drawSight"] ? [[params objectForKey:@"drawSight"] boolValue] : true;
if(drawSight){
if (drawSight) {
CGRect screenRect = [[UIScreen mainScreen] bounds]; CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width; CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height; CGFloat screenHeight = screenRect.size.height;
CGFloat dim = screenWidth < screenHeight ? screenWidth / 1.1 : screenHeight / 1.1; CGFloat dim = screenWidth < screenHeight ? screenWidth / 1.1 : screenHeight / 1.1;
UIView *polygonView = [[UIView alloc] initWithFrame: CGRectMake ( (screenWidth/2) - (dim/2), (screenHeight/2) - (dim/2), dim, dim)]; 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(0,dim / 2, dim, 1)];
lineView.backgroundColor = [UIColor redColor]; lineView.backgroundColor = [UIColor redColor];
[polygonView addSubview:lineView]; [polygonView addSubview:lineView];
self.cameraOverlayView = polygonView; self.cameraOverlayView = polygonView;
} }
} }
/*
#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 @end