Skip to content
This repository was archived by the owner on Jul 1, 2022. It is now read-only.

Commit 2cd2215

Browse files
AlexLittlejohnGuillaume Bellut
authored and
Guillaume Bellut
committed
Merge branch 'release/3.0.3'
2 parents 848775c + fa37fbd commit 2cd2215

File tree

17 files changed

+126
-91
lines changed

17 files changed

+126
-91
lines changed

Diff for: ALCameraViewController.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |spec|
22
spec.name = "ALCameraViewController"
3-
spec.version = "3.0.2"
3+
spec.version = "3.0.3"
44
spec.summary = "A camera view controller with custom image picker and image cropping."
55
spec.source = { :git => "https://github.com/AlexLittlejohn/ALCameraViewController.git", :tag => spec.version.to_s }
66
spec.requires_arc = true

Diff for: ALCameraViewController.xcodeproj/project.pbxproj

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
1F3C56291F701CA7009667E9 /* CroppingParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC96FA11F5B5166003E53F4 /* CroppingParameters.swift */; };
1111
7AC96FA21F5B5166003E53F4 /* CroppingParameters.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7AC96FA11F5B5166003E53F4 /* CroppingParameters.swift */; };
12+
7C6AF41F1FB340CA006CB4ED /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7C6AF41E1FB340CA006CB4ED /* LaunchScreen.xib */; };
1213
C40665441C73A47C00EB9751 /* SingleImageSaver.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40665431C73A47C00EB9751 /* SingleImageSaver.swift */; };
1314
C40665461C73A94100EB9751 /* CameraGlobals.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40665451C73A94100EB9751 /* CameraGlobals.swift */; };
1415
C40665481C73B72D00EB9751 /* SingleImageFetcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = C40665471C73B72D00EB9751 /* SingleImageFetcher.swift */; };
@@ -61,6 +62,7 @@
6162

6263
/* Begin PBXFileReference section */
6364
7AC96FA11F5B5166003E53F4 /* CroppingParameters.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CroppingParameters.swift; sourceTree = "<group>"; };
65+
7C6AF41E1FB340CA006CB4ED /* LaunchScreen.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LaunchScreen.xib; sourceTree = "<group>"; };
6466
C40665431C73A47C00EB9751 /* SingleImageSaver.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleImageSaver.swift; sourceTree = "<group>"; };
6567
C40665451C73A94100EB9751 /* CameraGlobals.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraGlobals.swift; sourceTree = "<group>"; };
6668
C40665471C73B72D00EB9751 /* SingleImageFetcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SingleImageFetcher.swift; sourceTree = "<group>"; };
@@ -196,6 +198,7 @@
196198
FAF058421B31618D008E5592 /* Supporting Files */ = {
197199
isa = PBXGroup;
198200
children = (
201+
7C6AF41E1FB340CA006CB4ED /* LaunchScreen.xib */,
199202
FAF0584B1B31618D008E5592 /* Images.xcassets */,
200203
FAF058431B31618D008E5592 /* Info.plist */,
201204
);
@@ -322,6 +325,7 @@
322325
files = (
323326
FA52EE0B1B44129B00E16B6F /* ViewController.xib in Resources */,
324327
FA8231381B3BF8F700A837BE /* CameraView.strings in Resources */,
328+
7C6AF41F1FB340CA006CB4ED /* LaunchScreen.xib in Resources */,
325329
FA5FA3451B3AFEB300497C62 /* CameraViewAssets.xcassets in Resources */,
326330
FAF0584C1B31618D008E5592 /* Images.xcassets in Resources */,
327331
FA778A411B8319D8005807E7 /* image.jpg in Resources */,
@@ -543,11 +547,10 @@
543547
isa = XCBuildConfiguration;
544548
buildSettings = {
545549
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
546-
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
547550
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
548551
DEVELOPMENT_TEAM = 2466624KEK;
549552
INFOPLIST_FILE = "Example/Supporting Files/Info.plist";
550-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
553+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
551554
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
552555
PRODUCT_BUNDLE_IDENTIFIER = com.alx.zero.CameraViewController;
553556
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -560,11 +563,10 @@
560563
isa = XCBuildConfiguration;
561564
buildSettings = {
562565
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
563-
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
564566
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
565567
DEVELOPMENT_TEAM = 2466624KEK;
566568
INFOPLIST_FILE = "Example/Supporting Files/Info.plist";
567-
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
569+
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
568570
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
569571
PRODUCT_BUNDLE_IDENTIFIER = com.alx.zero.CameraViewController;
570572
PRODUCT_NAME = "$(TARGET_NAME)";

Diff for: ALCameraViewController/ViewController/CameraViewControllerConstraint.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ extension CameraViewController {
4646

4747
let attribute : NSLayoutAttribute = {
4848
switch statusBarOrientation {
49-
case .portrait: return .bottom
50-
case .landscapeRight: return .right
51-
case .landscapeLeft: return .left
52-
default: return .top
49+
case .portrait: return .bottomMargin
50+
case .landscapeRight: return .rightMargin
51+
case .landscapeLeft: return .leftMargin
52+
default: return .topMargin
5353
}
5454
}()
5555

@@ -60,7 +60,7 @@ extension CameraViewController {
6060
toItem: view,
6161
attribute: attribute,
6262
multiplier: 1.0,
63-
constant: attribute == .right || attribute == .bottom ? -8 : 8)
63+
constant: -8)
6464
view.addConstraint(cameraButtonEdgeConstraint!)
6565
}
6666

@@ -401,7 +401,7 @@ extension CameraViewController {
401401
view.autoRemoveConstraint(flashButtonEdgeConstraint)
402402

403403
let constraintRight = statusBarOrientation == .portrait || statusBarOrientation == .landscapeRight
404-
let attribute : NSLayoutAttribute = constraintRight ? .top : .bottom
404+
let attribute : NSLayoutAttribute = constraintRight ? .topMargin : .bottomMargin
405405

406406
flashButtonEdgeConstraint = NSLayoutConstraint(
407407
item: flashButton,

Diff for: ALCameraViewController/ViewController/ConfirmViewController.swift

+14-20
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ public class ConfirmViewController: UIViewController, UIScrollViewDelegate {
106106
scrollView.minimumZoomScale = scale
107107
scrollView.zoomScale = scale
108108
centerScrollViewContents()
109-
centerImageViewOnRotate()
110109
}
111110

112111
public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
@@ -163,21 +162,13 @@ public class ConfirmViewController: UIViewController, UIScrollViewDelegate {
163162
}
164163

165164
guard let image = imageView.image else {
166-
return 1
165+
return 1
167166
}
168167

169168
let scaleWidth = _size.width / image.size.width
170169
let scaleHeight = _size.height / image.size.height
171-
172-
var scale: CGFloat
173-
174-
if croppingParameters.isEnabled {
175-
scale = max(scaleWidth, scaleHeight)
176-
} else {
177-
scale = min(scaleWidth, scaleHeight)
178-
}
179-
180-
return scale
170+
171+
return min(scaleWidth, scaleHeight)
181172
}
182173

183174
private func calculateScrollViewInsets(_ frame: CGRect) -> UIEdgeInsets {
@@ -318,14 +309,17 @@ public class ConfirmViewController: UIViewController, UIScrollViewDelegate {
318309
y: cropOverlay.frame.origin.y + cropOverlay.outterGap,
319310
width: cropOverlay.frame.size.width - 2 * cropOverlay.outterGap,
320311
height: cropOverlay.frame.size.height - 2 * cropOverlay.outterGap)
321-
cropRect.origin.x += scrollView.contentOffset.x
322-
cropRect.origin.y += scrollView.contentOffset.y
323-
324-
let normalizedX = cropRect.origin.x / imageView.frame.width
325-
let normalizedY = cropRect.origin.y / imageView.frame.height
326-
327-
let normalizedWidth = cropRect.width / imageView.frame.width
328-
let normalizedHeight = cropRect.height / imageView.frame.height
312+
cropRect.origin.x += scrollView.contentOffset.x - imageView.frame.origin.x
313+
cropRect.origin.y += scrollView.contentOffset.y - imageView.frame.origin.y
314+
315+
let normalizedX = max(0, cropRect.origin.x / imageView.frame.width)
316+
let normalizedY = max(0, cropRect.origin.y / imageView.frame.height)
317+
318+
let extraWidth = min(0, cropRect.origin.x)
319+
let extraHeight = min(0, cropRect.origin.y)
320+
321+
let normalizedWidth = min(1, (cropRect.width + extraWidth) / imageView.frame.width)
322+
let normalizedHeight = min(1, (cropRect.height + extraHeight) / imageView.frame.height)
329323

330324
return CGRect(x: normalizedX, y: normalizedY, width: normalizedWidth, height: normalizedHeight)
331325
}

Diff for: Example/Supporting Files/Images.xcassets/AppIcon.appiconset/Contents.json

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
313
{
414
"size" : "29x29",
515
"idiom" : "iphone",
@@ -25,8 +35,8 @@
2535
"scale" : "3x"
2636
},
2737
{
28-
"idiom" : "iphone",
2938
"size" : "60x60",
39+
"idiom" : "iphone",
3040
"filename" : "[email protected]",
3141
"scale" : "2x"
3242
},
@@ -35,10 +45,15 @@
3545
"idiom" : "iphone",
3646
"filename" : "[email protected]",
3747
"scale" : "3x"
48+
},
49+
{
50+
"idiom" : "ios-marketing",
51+
"size" : "1024x1024",
52+
"scale" : "1x"
3853
}
3954
],
4055
"info" : {
4156
"version" : 1,
4257
"author" : "xcode"
4358
}
44-
}
59+
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"filename" : "[email protected]",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
Loading

Diff for: Example/Supporting Files/Images.xcassets/LaunchImage.launchimage/Contents.json

-43
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

Diff for: Example/Supporting Files/Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<string>For Science</string>
2727
<key>NSPhotoLibraryUsageDescription</key>
2828
<string>For Science</string>
29+
<key>UILaunchStoryboardName</key>
30+
<string>LaunchScreen</string>
2931
<key>UIRequiredDeviceCapabilities</key>
3032
<array>
3133
<string>armv7</string>

Diff for: Example/Supporting Files/LaunchScreen.xib

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
3+
<device id="retina4_7" orientation="portrait">
4+
<adaptation id="fullscreen"/>
5+
</device>
6+
<dependencies>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
9+
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
10+
</dependencies>
11+
<objects>
12+
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
13+
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
14+
<view contentMode="scaleToFill" id="iN0-l3-epB">
15+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
16+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
17+
<subviews>
18+
<imageView userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Icon" translatesAutoresizingMaskIntoConstraints="NO" id="qT0-hI-WW6">
19+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
20+
</imageView>
21+
</subviews>
22+
<color key="backgroundColor" red="0.89411764705882346" green="0.44313725490196076" blue="0.36470588235294116" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
23+
<constraints>
24+
<constraint firstAttribute="trailing" secondItem="qT0-hI-WW6" secondAttribute="trailing" id="8eE-l4-Nl8"/>
25+
<constraint firstItem="qT0-hI-WW6" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="RPR-Lb-YTg"/>
26+
<constraint firstItem="qT0-hI-WW6" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Xh6-yC-K4f"/>
27+
<constraint firstAttribute="bottom" secondItem="qT0-hI-WW6" secondAttribute="bottom" id="ZKg-1P-IMr"/>
28+
</constraints>
29+
</view>
30+
</objects>
31+
<resources>
32+
<image name="Icon" width="90" height="90"/>
33+
</resources>
34+
</document>

0 commit comments

Comments
 (0)