2015-01-23 17:36:49 +08:00
|
|
|
//
|
|
|
|
// AlmaZBarReaderViewController.m
|
|
|
|
// BarCodeMix
|
|
|
|
//
|
|
|
|
// Created by eCompliance on 23/01/15.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "AlmaZBarReaderViewController.h"
|
2015-09-15 07:13:04 +08:00
|
|
|
#import "CsZbar.h"
|
2015-01-23 17:36:49 +08:00
|
|
|
|
|
|
|
@interface AlmaZBarReaderViewController ()
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation AlmaZBarReaderViewController
|
|
|
|
|
2015-09-15 07:13:04 +08:00
|
|
|
|
2015-01-23 17:36:49 +08:00
|
|
|
- (void)viewDidLoad {
|
|
|
|
[super viewDidLoad];
|
|
|
|
// Do any additional setup after loading the view.
|
2015-09-17 09:17:07 +08:00
|
|
|
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
|
|
|
|
//[button setTitle:@"Flash" forState:UIControlStateNormal];
|
2015-09-15 07:13:04 +08:00
|
|
|
[button sizeToFit];
|
2015-09-17 09:17:07 +08:00
|
|
|
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
|
|
|
//[button setContentEdgeInsets:UIEdgeInsetsMake(20, 30, 20, 30)];
|
|
|
|
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);
|
|
|
|
}else{
|
|
|
|
frame = CGRectMake(0,0, screenRect.size.width*(0.10), screenRect.size.height*0.20);
|
|
|
|
|
|
|
|
//button.center = CGPointMake(0,0);
|
|
|
|
}
|
|
|
|
|
|
|
|
button.frame =frame;
|
|
|
|
button.layer.cornerRadius = 10;
|
|
|
|
button.clipsToBounds = YES;
|
2015-09-15 07:13:04 +08:00
|
|
|
// Set a new (x,y) point for the button's center
|
2015-09-17 09:17:07 +08:00
|
|
|
|
2015-10-18 17:30:42 +08:00
|
|
|
|
2015-09-17 15:10:06 +08:00
|
|
|
|
2015-09-17 09:17:07 +08:00
|
|
|
//[button setBackgroundColor:[UIColor colorWithRed:.859 green:.765 blue:.616 alpha:1.0] forState:UIControlStateHighlighted];
|
|
|
|
|
|
|
|
//button.center = CGPointMake( 0,0);
|
2015-09-15 07:13:04 +08:00
|
|
|
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
2015-09-17 09:17:07 +08:00
|
|
|
|
2015-09-15 07:13:04 +08:00
|
|
|
[self.view addSubview:button];
|
2015-09-17 09:17:07 +08:00
|
|
|
|
2015-01-23 17:36:49 +08:00
|
|
|
}
|
2015-10-18 17:30:42 +08:00
|
|
|
- (BOOL)prefersStatusBarHidden {
|
|
|
|
return YES;
|
|
|
|
}
|
2015-01-23 17:36:49 +08:00
|
|
|
|
|
|
|
- (void)didReceiveMemoryWarning {
|
|
|
|
[super didReceiveMemoryWarning];
|
|
|
|
// Dispose of any resources that can be recreated.
|
|
|
|
}
|
2015-09-15 07:13:04 +08:00
|
|
|
//Techedge Changes NSS fase 2
|
|
|
|
- (void)buttonPressed: (UIButton *) button {
|
|
|
|
|
|
|
|
CsZBar *obj = [[CsZBar alloc] init];
|
|
|
|
|
2015-09-17 09:17:07 +08:00
|
|
|
[obj toggleflash];
|
|
|
|
|
2015-01-23 17:36:49 +08:00
|
|
|
}
|
|
|
|
|
2015-09-15 07:13:04 +08:00
|
|
|
|
|
|
|
- (BOOL)shouldAutorotate{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
|
|
|
|
//AlmaZBarReaderViewController.scanner.scanner.cameraOverlayView = poli
|
|
|
|
//NSDictionary *params = (NSDictionary*) [command argumentAtIndex:0];
|
|
|
|
BOOL drawSight = true;//[params objectForKey:@"drawSight"] ? [[params objectForKey:@"drawSight"] boolValue] : true;
|
|
|
|
if(drawSight){
|
|
|
|
CGRect screenRect = [[UIScreen mainScreen] bounds];
|
|
|
|
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 ( (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)];
|
|
|
|
lineView.backgroundColor = [UIColor redColor];
|
|
|
|
[polygonView addSubview:lineView];
|
|
|
|
self.cameraOverlayView = polygonView;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2015-01-23 17:36:49 +08:00
|
|
|
/*
|
2015-09-17 09:17:07 +08:00
|
|
|
#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.
|
|
|
|
}
|
|
|
|
*/
|
2015-01-23 17:36:49 +08:00
|
|
|
|
|
|
|
@end
|