iOS adding landscape sight

Adding landscape sight for iOS terminal, bug fix on iPad
This commit is contained in:
PaoloMessina 2015-01-23 10:36:49 +01:00
parent 0d9a53e476
commit dc04869ae1
3 changed files with 63 additions and 9 deletions

View File

@ -0,0 +1,13 @@
//
// AlmaZBarReaderViewController.h
// BarCodeMix
//
// Created by eCompliance on 23/01/15.
//
//
#import "ZBarReaderViewController.h"
@interface AlmaZBarReaderViewController : ZBarReaderViewController
@end

View File

@ -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

View File

@ -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];