cordova-plugin-cszbar-jsg/ios/AlmaZBarReaderViewController.m

80 lines
2.5 KiB
Mathematica
Raw Normal View History

//
// AlmaZBarReaderViewController.m
// BarCodeMix
//
// Created by eCompliance on 23/01/15.
#import "AlmaZBarReaderViewController.h"
#import "CsZbar.h"
@interface AlmaZBarReaderViewController ()
@end
@implementation AlmaZBarReaderViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
//[button setTitle:@"Flash" forState:UIControlStateNormal];
[button sizeToFit];
CGRect screenRect = [[UIScreen mainScreen] bounds];
//[button setContentEdgeInsets:UIEdgeInsetsMake(20, 30, 20, 30)];
CGRect frame;
2016-07-29 09:06:46 +08:00
if (screenRect.size.height > (screenRect.size.width)) {
frame = CGRectMake(0,0, screenRect.size.width*(0.15), screenRect.size.height*0.15);
}else{
frame = CGRectMake(0,0, screenRect.size.width*(0.10), screenRect.size.height*0.20);
}
button.frame =frame;
button.layer.cornerRadius = 10;
button.clipsToBounds = YES;
[button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
}
2016-07-29 09:06:46 +08:00
2015-10-18 17:30:42 +08:00
- (BOOL)prefersStatusBarHidden {
return YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
2016-07-29 09:06:46 +08:00
//Techedge Changes NSS fase 2
- (void)buttonPressed: (UIButton *) button {
CsZBar *obj = [[CsZBar alloc] init];
[obj toggleflash];
}
- (BOOL)shouldAutorotate{
return YES;
}
2016-07-29 09:06:46 +08:00
- (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;
2016-07-29 09:06:46 +08:00
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)];
2016-07-29 09:06:46 +08:00
UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0,dim / 2, dim, 1)];
lineView.backgroundColor = [UIColor redColor];
[polygonView addSubview:lineView];
self.cameraOverlayView = polygonView;
}
}
@end