Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

Commit 003a145

Browse files
committed
Fixed #20 Close Button
1 parent 61fc2dc commit 003a145

11 files changed

Lines changed: 465 additions & 383 deletions

File tree

IRLCamera.storyboard

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
99
<capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
1010
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1111
</dependencies>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// IRLScannerViewController.h
3+
//
4+
// Created by Denis Martin on 23/02/2018.
5+
// Copyright (c) 2015 Denis Martin. All rights reserved.
6+
//
7+
8+
@import Foundation;
9+
@import UIKit;
10+
11+
/**
12+
@brief UIButton utlitity
13+
*/
14+
@interface UIButton (HitTestEdgeInsetsExtensions)
15+
16+
/**
17+
@brief You can increase/reduce the hit detection radius of a button with this method.
18+
19+
To increase the radius you should pass Negative values, to reduce pass positive values.
20+
21+
@warning Use at your ow risk, do not increase the size too much and be aware of the button surrounding
22+
23+
@return hitTestEdgeInsets The current hitTestEdgeInsets.
24+
*/
25+
@property(nonatomic, assign) UIEdgeInsets hitTestEdgeInsets;
26+
27+
@end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// IRLScannerViewController.m
3+
//
4+
// Created by Denis Martin on 23/02/2018.
5+
// Copyright (c) 2015 Denis Martin. All rights reserved.
6+
//
7+
8+
9+
#import "UIButton+Extensions.h"
10+
#import <objc/runtime.h>
11+
12+
@implementation UIButton (HitTestEdgeInsetsExtensions)
13+
@dynamic hitTestEdgeInsets;
14+
15+
static const NSString *HitTestEdgeInsetsKey = @"HitTestEdgeInsets";
16+
17+
-(void)setHitTestEdgeInsets:(UIEdgeInsets)hitTestEdgeInsets {
18+
NSValue *value = [NSValue value:&hitTestEdgeInsets withObjCType:@encode(UIEdgeInsets)];
19+
objc_setAssociatedObject(self, &HitTestEdgeInsetsKey, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
20+
}
21+
22+
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event {
23+
if(UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero) || !self.enabled || self.hidden) {
24+
return [super pointInside:point withEvent:event];
25+
}
26+
27+
CGRect relativeFrame = self.bounds;
28+
CGRect hitFrame = UIEdgeInsetsInsetRect(relativeFrame, self.hitTestEdgeInsets);
29+
30+
return CGRectContainsPoint(hitFrame, point);
31+
}
32+
33+
-(UIEdgeInsets)hitTestEdgeInsets {
34+
NSValue *value = objc_getAssociatedObject(self, &HitTestEdgeInsetsKey);
35+
if(value) {
36+
UIEdgeInsets edgeInsets; [value getValue:&edgeInsets]; return edgeInsets;
37+
}else {
38+
return UIEdgeInsetsZero;
39+
}
40+
}
41+
42+
@end

Source/Public/IRLScannerViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ NS_CLASS_AVAILABLE(NA, 8_0)
229229
/**
230230
@brief <Deprecated> This property was introduce by mistake and is not use in the project.
231231
*/
232-
@property(nonatomic, assign) id _Nullable delegate __deprecated_msg("This property was introduce by mistake and is not use in the project!");;
232+
@property(nonatomic, assign) id _Nullable delegate __deprecated_msg("This property was introduce by mistake and is not use in the project!");
233233

234234
@end
235235

Source/Public/IRLScannerViewController.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#import "IRLScannerViewController.h"
99
#import "IRLCameraView.h"
10+
#import "UIButton+Extensions.h"
1011

1112
@interface IRLScannerViewController () <IRLCameraViewProtocol, TOCropViewControllerDelegate>
1213

@@ -116,6 +117,9 @@ - (void)viewDidLoad {
116117

117118
[self.cameraView start];
118119

120+
// Increase Cancel button Hit Radius
121+
self.cancel_button.hitTestEdgeInsets = UIEdgeInsetsMake(-40, -40, -40, -40);
122+
119123
}
120124

121125
- (void)viewWillAppear:(BOOL)animated {

demo/Podfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PODS:
2-
- IRLDocumentScanner (0.3.0):
3-
- IRLDocumentScanner/Default (= 0.3.0)
2+
- IRLDocumentScanner (0.3.1):
3+
- IRLDocumentScanner/Default (= 0.3.1)
44
- TOCropViewController (~> 2.3)
5-
- IRLDocumentScanner/Default (0.3.0):
5+
- IRLDocumentScanner/Default (0.3.1):
66
- TOCropViewController (~> 2.3)
77
- TOCropViewController (2.3.4)
88

@@ -14,7 +14,7 @@ EXTERNAL SOURCES:
1414
:path: ..
1515

1616
SPEC CHECKSUMS:
17-
IRLDocumentScanner: 03cbb48f5b8188bd38445dd85297209e71d820b5
17+
IRLDocumentScanner: 37606725c316aad3f6f08a94cb357823ec4b142d
1818
TOCropViewController: 808c9724904be931dd2de5f97fcccf4cc8f8b03f
1919

2020
PODFILE CHECKSUM: 33215c6da8b5132d7a127b02388901f868b65cd5

demo/Pods/Local Podspecs/IRLDocumentScanner.podspec.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/Pods/Manifest.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)