From 58e2da4f24919938006a4fd58fd67ade01196e14 Mon Sep 17 00:00:00 2001 From: PaoloMessina Date: Mon, 22 Dec 2014 15:51:57 +0100 Subject: [PATCH] iOS sight missing iOS sight missing --- ios/CsZBar.m | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ios/CsZBar.m b/ios/CsZBar.m index c83e4fd..a24f891 100644 --- a/ios/CsZBar.m +++ b/ios/CsZBar.m @@ -63,6 +63,25 @@ // Hack to hide the bottom bar's Info button... http://stackoverflow.com/a/16353530 //UIView *infoButton = [[[[[self.scanReader.view.subviews objectAtIndex:1] subviews] objectAtIndex:0] subviews] objectAtIndex:3]; //[infoButton setHidden:YES]; + + BOOL drawSight = [[params objectForKey:@"drawSight"] boolValue]; + 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 ( 0, 0, 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.scanReader.cameraOverlayView = polygonView; + //[self.scanReader.view addSubview:polygonView]; + } [self.viewController presentModalViewController: self.scanReader animated: YES]; }