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 "CsZBar.h"
#import "AlmaZBarReaderViewController.h"
#pragma mark - State #pragma mark - State
@interface CsZBar () @interface CsZBar ()
@property bool scanInProgress; @property bool scanInProgress;
@property NSString *scanCallbackId; @property NSString *scanCallbackId;
@property ZBarReaderViewController *scanReader; @property AlmaZBarReaderViewController *scanReader;
@end @end
@ -40,10 +40,10 @@
} else { } else {
self.scanInProgress = YES; self.scanInProgress = YES;
self.scanCallbackId = [command callbackId]; self.scanCallbackId = [command callbackId];
self.scanReader = [ZBarReaderViewController new]; self.scanReader = [AlmaZBarReaderViewController new];
self.scanReader.readerDelegate = self; self.scanReader.readerDelegate = self;
self.scanReader.supportedOrientationsMask = ZBarOrientationMaskAll; self.scanReader.supportedOrientationsMask = ZBarOrientationMask(UIInterfaceOrientationPortrait);
// Get user parameters // Get user parameters
NSDictionary *params = (NSDictionary*) [command argumentAtIndex:0]; NSDictionary *params = (NSDictionary*) [command argumentAtIndex:0];
@ -70,12 +70,12 @@
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 ( 0, 0, 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.center = self.scanReader.view.center;
polygonView.layer.borderColor = [UIColor greenColor].CGColor; //polygonView.layer.borderColor = [UIColor greenColor].CGColor;
polygonView.layer.borderWidth = 3.0f; //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]; lineView.backgroundColor = [UIColor redColor];
[polygonView addSubview:lineView]; [polygonView addSubview:lineView];