├── Pod ├── Assets │ ├── .gitkeep │ ├── grid.png │ ├── close.png │ ├── close@2x.png │ ├── close@3x.png │ ├── flash-off.png │ ├── flash-on.png │ ├── grid@2x.png │ ├── grid@3x.png │ ├── flash-auto.png │ ├── flash-on@2x.png │ ├── flash-auto@2x.png │ ├── flash-off@2x.png │ ├── switch-camera.png │ ├── switch-camera@2x.png │ ├── flash-unavailable.png │ └── flash-unavailable@2x.png └── Classes │ ├── .gitkeep │ ├── PXLibraryButton.h │ ├── PXCameraPreviewView.h │ ├── PXCameraButton.h │ ├── PXCameraDisplayView.h │ ├── PXCameraGridLayer.h │ ├── PXCameraPreviewView.m │ ├── PXSpanPicker.h │ ├── PXFlashControl.h │ ├── PXCameraViewController.h │ ├── PXImagePickerHelper.h │ ├── PXCameraDisplayView.m │ ├── PXCameraGridLayer.m │ ├── PXCameraView.h │ ├── PXCameraCaptureManager.h │ ├── PXCameraButton.m │ ├── PXCamera.h │ ├── PXImagePickerHelper.m │ ├── PXCamera.m │ ├── PXLibraryButton.m │ └── PXFlashControl.m ├── Example ├── Pods │ ├── Headers │ │ ├── Private │ │ │ ├── PXCamera │ │ │ │ ├── PXCamera.h │ │ │ │ ├── PXCameraView.h │ │ │ │ ├── PXSpanPicker.h │ │ │ │ ├── PXCameraButton.h │ │ │ │ ├── PXFlashControl.h │ │ │ │ ├── PXCameraGridLayer.h │ │ │ │ ├── PXLibraryButton.h │ │ │ │ ├── PXCameraDisplayView.h │ │ │ │ ├── PXCameraPreviewView.h │ │ │ │ ├── PXImagePickerHelper.h │ │ │ │ ├── PXCameraCaptureManager.h │ │ │ │ └── PXCameraViewController.h │ │ │ ├── SVProgressHUD │ │ │ │ ├── SVProgressHUD.h │ │ │ │ └── SVIndefiniteAnimatedView.h │ │ │ └── PXPinnedRotation │ │ │ │ ├── PXPinnedRotationView.h │ │ │ │ └── PXPinnedRotationViewController.h │ │ └── Public │ │ │ ├── PXCamera │ │ │ ├── PXCamera.h │ │ │ ├── PXCameraCaptureManager.h │ │ │ └── PXCameraViewController.h │ │ │ ├── SVProgressHUD │ │ │ ├── SVProgressHUD.h │ │ │ └── SVIndefiniteAnimatedView.h │ │ │ └── PXPinnedRotation │ │ │ ├── PXPinnedRotationView.h │ │ │ └── PXPinnedRotationViewController.h │ ├── SVProgressHUD │ │ ├── SVProgressHUD │ │ │ ├── SVProgressHUD.bundle │ │ │ │ ├── error.png │ │ │ │ ├── info.png │ │ │ │ ├── error@2x.png │ │ │ │ ├── error@3x.png │ │ │ │ ├── info@2x.png │ │ │ │ ├── info@3x.png │ │ │ │ ├── success.png │ │ │ │ ├── angle-mask.png │ │ │ │ ├── success@2x.png │ │ │ │ ├── success@3x.png │ │ │ │ ├── angle-mask@2x.png │ │ │ │ └── angle-mask@3x.png │ │ │ ├── SVIndefiniteAnimatedView.h │ │ │ ├── SVProgressHUD.h │ │ │ └── SVIndefiniteAnimatedView.m │ │ ├── LICENSE.txt │ │ └── README.md │ ├── Target Support Files │ │ ├── PXCamera │ │ │ ├── PXCamera-dummy.m │ │ │ ├── PXCamera-prefix.pch │ │ │ ├── ResourceBundle-PXCamera-Info.plist │ │ │ └── PXCamera.xcconfig │ │ ├── Pods-Tests │ │ │ ├── Pods-Tests-dummy.m │ │ │ ├── Pods-Tests.debug.xcconfig │ │ │ ├── Pods-Tests.release.xcconfig │ │ │ ├── Pods-Tests-frameworks.sh │ │ │ ├── Pods-Tests-acknowledgements.markdown │ │ │ ├── Pods-Tests-acknowledgements.plist │ │ │ └── Pods-Tests-resources.sh │ │ ├── Pods-PXCamera │ │ │ ├── Pods-PXCamera-dummy.m │ │ │ ├── Pods-PXCamera.debug.xcconfig │ │ │ ├── Pods-PXCamera.release.xcconfig │ │ │ ├── Pods-PXCamera-frameworks.sh │ │ │ ├── Pods-PXCamera-acknowledgements.markdown │ │ │ ├── Pods-PXCamera-acknowledgements.plist │ │ │ └── Pods-PXCamera-resources.sh │ │ ├── SVProgressHUD │ │ │ ├── SVProgressHUD-dummy.m │ │ │ ├── SVProgressHUD-prefix.pch │ │ │ └── SVProgressHUD.xcconfig │ │ └── PXPinnedRotation │ │ │ ├── PXPinnedRotation-dummy.m │ │ │ ├── PXPinnedRotation-prefix.pch │ │ │ ├── PXPinnedRotation.xcconfig │ │ │ └── ResourceBundle-PXPinnedRotation-Info.plist │ ├── Manifest.lock │ ├── PXPinnedRotation │ │ ├── LICENSE │ │ ├── README.md │ │ └── Pod │ │ │ └── Classes │ │ │ ├── PXPinnedRotationViewController.h │ │ │ ├── PXPinnedRotationView.h │ │ │ └── PXPinnedRotationViewController.m │ └── Local Podspecs │ │ └── PXCamera.podspec.json ├── Tests │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── Tests-Prefix.pch │ ├── Tests-Info.plist │ └── Tests.m ├── PXCamera │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── Images.xcassets │ │ ├── Contents.json │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── LaunchImage.launchimage │ │ │ └── Contents.json │ ├── PXExampleViewController.h │ ├── PXAppDelegate.h │ ├── PXCustomCameraView.h │ ├── PXCamera-Prefix.pch │ ├── PXCustomCameraViewController.h │ ├── main.m │ ├── main.storyboard │ ├── PXCamera-Info.plist │ ├── PXCustomCameraView.m │ ├── PXCustomCameraViewController.m │ ├── PXAppDelegate.m │ └── PXExampleViewController.m ├── Podfile ├── PXCamera.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── PXCamera-Example.xcscheme ├── PXCamera.xcworkspace │ └── contents.xcworkspacedata └── Podfile.lock ├── .travis.yml ├── .gitignore ├── LICENSE ├── PXCamera.podspec └── README.md /Pod/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Pod/Classes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXCamera.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCamera.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/PXCamera/PXCamera.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCamera.h -------------------------------------------------------------------------------- /Pod/Assets/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/grid.png -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXCameraView.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXSpanPicker.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXSpanPicker.h -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Pod/Assets/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/close.png -------------------------------------------------------------------------------- /Example/PXCamera/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXCameraButton.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraButton.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXFlashControl.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXFlashControl.h -------------------------------------------------------------------------------- /Pod/Assets/close@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/close@2x.png -------------------------------------------------------------------------------- /Pod/Assets/close@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/close@3x.png -------------------------------------------------------------------------------- /Pod/Assets/flash-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/flash-off.png -------------------------------------------------------------------------------- /Pod/Assets/flash-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/flash-on.png -------------------------------------------------------------------------------- /Pod/Assets/grid@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/grid@2x.png -------------------------------------------------------------------------------- /Pod/Assets/grid@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/grid@3x.png -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXCameraGridLayer.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraGridLayer.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXLibraryButton.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXLibraryButton.h -------------------------------------------------------------------------------- /Pod/Assets/flash-auto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/flash-auto.png -------------------------------------------------------------------------------- /Pod/Assets/flash-on@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/flash-on@2x.png -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXCameraDisplayView.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraDisplayView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXCameraPreviewView.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraPreviewView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXImagePickerHelper.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXImagePickerHelper.h -------------------------------------------------------------------------------- /Pod/Assets/flash-auto@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/flash-auto@2x.png -------------------------------------------------------------------------------- /Pod/Assets/flash-off@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/flash-off@2x.png -------------------------------------------------------------------------------- /Pod/Assets/switch-camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/switch-camera.png -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXCameraCaptureManager.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraCaptureManager.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXCamera/PXCameraViewController.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraViewController.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVProgressHUD.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/PXCamera/PXCameraCaptureManager.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraCaptureManager.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/PXCamera/PXCameraViewController.h: -------------------------------------------------------------------------------- 1 | ../../../../../Pod/Classes/PXCameraViewController.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVProgressHUD.h -------------------------------------------------------------------------------- /Pod/Assets/switch-camera@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/switch-camera@2x.png -------------------------------------------------------------------------------- /Pod/Assets/flash-unavailable.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/flash-unavailable.png -------------------------------------------------------------------------------- /Pod/Assets/flash-unavailable@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Pod/Assets/flash-unavailable@2x.png -------------------------------------------------------------------------------- /Example/PXCamera/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXPinnedRotation/PXPinnedRotationView.h: -------------------------------------------------------------------------------- 1 | ../../../PXPinnedRotation/Pod/Classes/PXPinnedRotationView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/PXPinnedRotation/PXPinnedRotationView.h: -------------------------------------------------------------------------------- 1 | ../../../PXPinnedRotation/Pod/Classes/PXPinnedRotationView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/SVProgressHUD/SVIndefiniteAnimatedView.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/SVProgressHUD/SVIndefiniteAnimatedView.h: -------------------------------------------------------------------------------- 1 | ../../../SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Private/PXPinnedRotation/PXPinnedRotationViewController.h: -------------------------------------------------------------------------------- 1 | ../../../PXPinnedRotation/Pod/Classes/PXPinnedRotationViewController.h -------------------------------------------------------------------------------- /Example/Pods/Headers/Public/PXPinnedRotation/PXPinnedRotationViewController.h: -------------------------------------------------------------------------------- 1 | ../../../PXPinnedRotation/Pod/Classes/PXPinnedRotationViewController.h -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@2x.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/error@3x.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@2x.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/info@3x.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@2x.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/success@3x.png -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PXCamera/PXCamera-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PXCamera : NSObject 3 | @end 4 | @implementation PodsDummy_PXCamera 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@2x.png -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pixio/PXCamera/HEAD/Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle/angle-mask@3x.png -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PXCamera/Pods-PXCamera-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_PXCamera : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_PXCamera 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SVProgressHUD/SVProgressHUD-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_SVProgressHUD : NSObject 3 | @end 4 | @implementation PodsDummy_SVProgressHUD 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | source 'https://github.com/CocoaPods/Specs.git' 2 | 3 | target 'PXCamera' do 4 | pod "PXCamera", :path => "../" 5 | end 6 | 7 | target 'Tests' do 8 | pod "PXCamera", :path => "../" 9 | end 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PXPinnedRotation/PXPinnedRotation-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_PXPinnedRotation : NSObject 3 | @end 4 | @implementation PodsDummy_PXPinnedRotation 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every test case source file. 5 | // 6 | 7 | #ifdef __OBJC__ 8 | 9 | 10 | 11 | #endif 12 | -------------------------------------------------------------------------------- /Example/PXCamera.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PXCamera/PXCamera-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SVProgressHUD/SVProgressHUD-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/PXCamera.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PXPinnedRotation/PXPinnedRotation-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #else 4 | #ifndef FOUNDATION_EXPORT 5 | #if defined(__cplusplus) 6 | #define FOUNDATION_EXPORT extern "C" 7 | #else 8 | #define FOUNDATION_EXPORT extern 9 | #endif 10 | #endif 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Example/PXCamera/PXExampleViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXViewController.h 3 | // PXCamera 4 | // 5 | // Created by Daniel Blakemore on 05/01/2015. 6 | // Copyright (c) 2014 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PXExampleViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/PXCamera/PXAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXAppDelegate.h 3 | // PXCamera 4 | // 5 | // Created by CocoaPods on 05/01/2015. 6 | // Copyright (c) 2014 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PXAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/PXCamera/PXCustomCameraView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCustomCameraView.h 3 | // PXCamera 4 | // 5 | // Created by Daniel Blakemore on 12/23/15. 6 | // Copyright © 2015 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PXCustomCameraView : UIView 12 | 13 | @property (nonatomic, readonly) UIButton * shutterButton; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/PXCamera/PXCamera-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/PXCamera/PXCustomCameraViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCustomCameraViewController.h 3 | // PXCamera 4 | // 5 | // Created by Daniel Blakemore on 12/23/15. 6 | // Copyright © 2015 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PXCustomCameraViewController : UIViewController 12 | 13 | - (instancetype)initWithCompletion:(void(^)(UIImage * image, BOOL pictureTaken))completion; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/PXCamera/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PXCamera 4 | // 5 | // Created by Daniel Blakemore on 05/01/2015. 6 | // Copyright (c) 2014 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "PXAppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([PXAppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVIndefiniteAnimatedView.h 3 | // SVProgressHUD 4 | // 5 | // Created by Guillaume Campagna on 2014-12-05. 6 | // 7 | // 8 | 9 | #import 10 | 11 | @interface SVIndefiniteAnimatedView : UIView 12 | 13 | @property (nonatomic, assign) CGFloat strokeThickness; 14 | @property (nonatomic, assign) CGFloat radius; 15 | @property (nonatomic, strong) UIColor *strokeColor; 16 | 17 | @end 18 | 19 | -------------------------------------------------------------------------------- /Example/PXCamera/main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PXCamera (0.2.8): 3 | - PXPinnedRotation 4 | - SVProgressHUD 5 | - PXPinnedRotation (0.1.3) 6 | - SVProgressHUD (1.1.3) 7 | 8 | DEPENDENCIES: 9 | - PXCamera (from `../`) 10 | 11 | EXTERNAL SOURCES: 12 | PXCamera: 13 | :path: "../" 14 | 15 | SPEC CHECKSUMS: 16 | PXCamera: f45a8a87c1882269023157432cbda3660487f985 17 | PXPinnedRotation: 44d23d18c495b91a35ef69dacae9c566afe01bb9 18 | SVProgressHUD: 748080e4f36e603f6c02aec292664239df5279c1 19 | 20 | PODFILE CHECKSUM: a197e66bc50943de29d7ce4414e432c7c5c20386 21 | 22 | COCOAPODS: 1.2.0 23 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - PXCamera (0.2.8): 3 | - PXPinnedRotation 4 | - SVProgressHUD 5 | - PXPinnedRotation (0.1.3) 6 | - SVProgressHUD (1.1.3) 7 | 8 | DEPENDENCIES: 9 | - PXCamera (from `../`) 10 | 11 | EXTERNAL SOURCES: 12 | PXCamera: 13 | :path: "../" 14 | 15 | SPEC CHECKSUMS: 16 | PXCamera: f45a8a87c1882269023157432cbda3660487f985 17 | PXPinnedRotation: 44d23d18c495b91a35ef69dacae9c566afe01bb9 18 | SVProgressHUD: 748080e4f36e603f6c02aec292664239df5279c1 19 | 20 | PODFILE CHECKSUM: a197e66bc50943de29d7ce4414e432c7c5c20386 21 | 22 | COCOAPODS: 1.2.0 23 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | language: objective-c 6 | # cache: cocoapods 7 | # podfile: Example/Podfile 8 | # before_install: 9 | # - gem install cocoapods # Since Travis is not always on latest version 10 | # - pod install --project-directory=Example 11 | install: 12 | - gem install xcpretty --no-rdoc --no-ri --no-document --quiet 13 | script: 14 | - set -o pipefail && xcodebuild test -workspace Example/PXCamera.xcworkspace -scheme PXCamera-Example -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO | xcpretty -c 15 | - pod lib lint --quick 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OS X 2 | .DS_Store 3 | 4 | # Xcode 5 | build/ 6 | *.pbxuser 7 | !default.pbxuser 8 | *.mode1v3 9 | !default.mode1v3 10 | *.mode2v3 11 | !default.mode2v3 12 | *.perspectivev3 13 | !default.perspectivev3 14 | xcuserdata 15 | *.xccheckout 16 | profile 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | 22 | # Bundler 23 | .bundle 24 | 25 | # We recommend against adding the Pods directory to your .gitignore. However 26 | # you should judge for yourself, the pros and cons are mentioned at: 27 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 28 | # 29 | # Note: if you ignore the Pods directory, make sure to uncomment 30 | # `pod install` in .travis.yml 31 | # 32 | # Pods/ 33 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/SVProgressHUD/SVProgressHUD.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/SVProgressHUD 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/SVProgressHUD" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PXCamera" "${PODS_ROOT}/Headers/Public/PXPinnedRotation" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 4 | OTHER_LDFLAGS = -framework "QuartzCore" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/SVProgressHUD 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraTests.m 3 | // PXCameraTests 4 | // 5 | // Created by Daniel Blakemore on 05/01/2015. 6 | // Copyright (c) 2014 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface Tests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation Tests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PXPinnedRotation/PXPinnedRotation.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PXPinnedRotation" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PXCamera" "${PODS_ROOT}/Headers/Public/PXPinnedRotation" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 4 | OTHER_LDFLAGS = -framework "UIKit" 5 | PODS_BUILD_DIR = $BUILD_DIR 6 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_ROOT = ${SRCROOT} 8 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/PXPinnedRotation 9 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 10 | SKIP_INSTALL = YES 11 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PXCamera/ResourceBundle-PXCamera-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleIdentifier 8 | ${PRODUCT_BUNDLE_IDENTIFIER} 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundleName 12 | ${PRODUCT_NAME} 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 0.2.8 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PXPinnedRotation/ResourceBundle-PXPinnedRotation-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleIdentifier 8 | ${PRODUCT_BUNDLE_IDENTIFIER} 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundleName 12 | ${PRODUCT_NAME} 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 0.1.3 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/PXCamera/PXCamera.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/PXCamera 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/PXCamera" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PXCamera" "${PODS_ROOT}/Headers/Public/PXPinnedRotation" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 4 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation" "$PODS_CONFIGURATION_BUILD_DIR/SVProgressHUD" 5 | OTHER_LDFLAGS = -framework "AVFoundation" -framework "AssetsLibrary" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT} 9 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 10 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 11 | SKIP_INSTALL = YES 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PXCamera" "${PODS_ROOT}/Headers/Public/PXPinnedRotation" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/PXCamera" "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation" "$PODS_CONFIGURATION_BUILD_DIR/SVProgressHUD" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/PXCamera" -isystem "${PODS_ROOT}/Headers/Public/PXPinnedRotation" -isystem "${PODS_ROOT}/Headers/Public/SVProgressHUD" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"PXCamera" -l"PXPinnedRotation" -l"SVProgressHUD" -framework "AVFoundation" -framework "AssetsLibrary" -framework "QuartzCore" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Tests/Pods-Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PXCamera" "${PODS_ROOT}/Headers/Public/PXPinnedRotation" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/PXCamera" "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation" "$PODS_CONFIGURATION_BUILD_DIR/SVProgressHUD" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/PXCamera" -isystem "${PODS_ROOT}/Headers/Public/PXPinnedRotation" -isystem "${PODS_ROOT}/Headers/Public/SVProgressHUD" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"PXCamera" -l"PXPinnedRotation" -l"SVProgressHUD" -framework "AVFoundation" -framework "AssetsLibrary" -framework "QuartzCore" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PXCamera/Pods-PXCamera.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PXCamera" "${PODS_ROOT}/Headers/Public/PXPinnedRotation" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/PXCamera" "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation" "$PODS_CONFIGURATION_BUILD_DIR/SVProgressHUD" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/PXCamera" -isystem "${PODS_ROOT}/Headers/Public/PXPinnedRotation" -isystem "${PODS_ROOT}/Headers/Public/SVProgressHUD" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"PXCamera" -l"PXPinnedRotation" -l"SVProgressHUD" -framework "AVFoundation" -framework "AssetsLibrary" -framework "QuartzCore" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PXCamera/Pods-PXCamera.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/PXCamera" "${PODS_ROOT}/Headers/Public/PXPinnedRotation" "${PODS_ROOT}/Headers/Public/SVProgressHUD" 3 | LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/PXCamera" "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation" "$PODS_CONFIGURATION_BUILD_DIR/SVProgressHUD" 4 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/PXCamera" -isystem "${PODS_ROOT}/Headers/Public/PXPinnedRotation" -isystem "${PODS_ROOT}/Headers/Public/SVProgressHUD" 5 | OTHER_LDFLAGS = $(inherited) -ObjC -l"PXCamera" -l"PXPinnedRotation" -l"SVProgressHUD" -framework "AVFoundation" -framework "AssetsLibrary" -framework "QuartzCore" -framework "UIKit" 6 | PODS_BUILD_DIR = $BUILD_DIR 7 | PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Daniel Blakemore 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Example/Pods/PXPinnedRotation/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Daniel Blakemore 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /PXCamera.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "PXCamera" 3 | s.version = "0.2.8" 4 | s.summary = "A camera and photo library library with class methods for ease." 5 | s.description = <<-DESC 6 | A couple of classes for presenting a camera that can pick from your photo library and a class for quickly prompting the user to pick from the photo library. 7 | Additionally, a class for easily controlling and managing a custom camera interface. 8 | DESC 9 | s.homepage = "https://github.com/pixio/PXCamera" 10 | s.license = 'MIT' 11 | s.author = { "Daniel Blakemore" => "DanBlakemore@gmail.com" } 12 | s.source = { 13 | :git => "https://github.com/pixio/PXCamera.git", 14 | :tag => s.version.to_s 15 | } 16 | 17 | s.platform = :ios, '7.0' 18 | s.requires_arc = true 19 | 20 | s.source_files = 'Pod/Classes/**/*' 21 | s.resource_bundles = { 22 | 'PXCamera' => ['Pod/Assets/*.png'] 23 | } 24 | 25 | s.public_header_files = 'Pod/Classes/PXCamera.h', 'Pod/Classes/PXCameraCaptureManager.h', 'Pod/Classes/PXCameraViewController.h' 26 | s.frameworks = 'UIKit', 'AssetsLibrary', 'AVFoundation' 27 | s.dependency 'SVProgressHUD' 28 | s.dependency 'PXPinnedRotation' 29 | end 30 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/PXCamera.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "PXCamera", 3 | "version": "0.2.8", 4 | "summary": "A camera and photo library library with class methods for ease.", 5 | "description": "A couple of classes for presenting a camera that can pick from your photo library and a class for quickly prompting the user to pick from the photo library.\nAdditionally, a class for easily controlling and managing a custom camera interface.", 6 | "homepage": "https://github.com/pixio/PXCamera", 7 | "license": "MIT", 8 | "authors": { 9 | "Daniel Blakemore": "DanBlakemore@gmail.com" 10 | }, 11 | "source": { 12 | "git": "https://github.com/pixio/PXCamera.git", 13 | "tag": "0.2.8" 14 | }, 15 | "platforms": { 16 | "ios": "7.0" 17 | }, 18 | "requires_arc": true, 19 | "source_files": "Pod/Classes/**/*", 20 | "resource_bundles": { 21 | "PXCamera": [ 22 | "Pod/Assets/*.png" 23 | ] 24 | }, 25 | "public_header_files": [ 26 | "Pod/Classes/PXCamera.h", 27 | "Pod/Classes/PXCameraCaptureManager.h", 28 | "Pod/Classes/PXCameraViewController.h" 29 | ], 30 | "frameworks": [ 31 | "UIKit", 32 | "AssetsLibrary", 33 | "AVFoundation" 34 | ], 35 | "dependencies": { 36 | "SVProgressHUD": [ 37 | 38 | ], 39 | "PXPinnedRotation": [ 40 | 41 | ] 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2014 Sam Vermette 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | A different license may apply to other resources included in this package, 25 | including Freepik Icons. Please consult their 26 | respective headers for the terms of their individual licenses. -------------------------------------------------------------------------------- /Pod/Classes/PXLibraryButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXLibraryButton.h 3 | // 4 | // Created by Daniel Blakemore on 7/21/14. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | @interface PXLibraryButton : UIControl 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraPreviewView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraPreviewView.h 3 | // 4 | // Copyright (c) 2015 Pixio 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | #import 26 | 27 | @interface PXCameraPreviewView : UIView 28 | 29 | @property (nonatomic, nullable) CALayer * previewLayer; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraButton.h 3 | // 4 | // Created by Daniel Blakemore on 9/11/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | @interface PXCameraButton : UIControl 30 | 31 | @property (nonatomic, nullable) NSString * countDown; // the final 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraDisplayView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraDisplayView.h 3 | // 4 | // Created by Daniel Blakemore on 8/21/15. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | @interface PXCameraDisplayView : UIView 30 | 31 | @property (nonatomic) BOOL gridHidden; 32 | 33 | - (void) ensureCameraPreviewViewAttached; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraGridLayer.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraDisplayView.h 3 | // 4 | // Created by Daniel Blakemore on 8/14/15. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | @interface PXCameraGridLayer : CALayer 30 | 31 | /** 32 | * Whether the grid is hidden or shown. Default value is TRUE (hidden). 33 | */ 34 | @property (nonatomic) BOOL gridHidden; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/PXCamera/PXCamera-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | NSCameraUsageDescription 28 | testing 29 | NSPhotoLibraryUsageDescription 30 | testing 31 | UILaunchStoryboardName 32 | main 33 | UIRequiredDeviceCapabilities 34 | 35 | armv7 36 | 37 | UIRequiresFullScreen 38 | 39 | UISupportedInterfaceOrientations 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationLandscapeRight 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationPortraitUpsideDown 45 | 46 | UISupportedInterfaceOrientations~ipad 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationPortraitUpsideDown 50 | UIInterfaceOrientationLandscapeLeft 51 | UIInterfaceOrientationLandscapeRight 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /Example/Pods/PXPinnedRotation/README.md: -------------------------------------------------------------------------------- 1 | # PXPinnedRotation 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/PXPinnedRotation.svg?style=flat)](http://cocoapods.org/pods/PXPinnedRotation) 4 | [![License](https://img.shields.io/cocoapods/l/PXPinnedRotation.svg?style=flat)](http://cocoapods.org/pods/PXPinnedRotation) 5 | [![Platform](https://img.shields.io/cocoapods/p/PXPinnedRotation.svg?style=flat)](http://cocoapods.org/pods/PXPinnedRotation) 6 | 7 | ## Usage 8 | 9 | `PXPinnedRotation` allows you to create views that use pinned rotation: 10 | 11 | ![Pinned Rotation](pinned.gif) 12 | 13 | Your views will stay in place but rotate when the phone rotates like with the library and filter buttons in the Camera app in iOS. 14 | 15 | There are a few things that you need to do to use `PXPinnedRotation`: 16 | 17 | 1. Subclass `PXPinnedRotationView` and `PXPinnedRotationViewController`. 18 | 2. Call `[self addSubviewToAnimate:]` with your animated subviews (buttons, labels, etc.). 19 | 3. Call `[self manuallyStartLayoutPass]` at the end of init. 20 | 4. Implement `-(NSArray*)calculateBaseConstraintsBeforeLayoutPass` and put all the code in here that you would normally put in `-(void)updateConstraints`. 21 | 22 | Any views you have specified to animate will be animated. Anything else will not change at all during rotation. 23 | 24 | There are blocks you can assign on the view controller if you need additional behavior during or after rotation. Check out the headers for more info. 25 | 26 | There's also the example project shown above. To run it, clone the repo, and run `pod install` from the Example directory first. 27 | 28 | ## Installation 29 | 30 | PXPinnedRotation is available through [CocoaPods](http://cocoapods.org). To install 31 | it, simply add the following line to your Podfile: 32 | 33 | ```ruby 34 | pod "PXPinnedRotation" 35 | ``` 36 | 37 | ## Author 38 | 39 | Daniel Blakemore, DanBlakemore@gmail.com 40 | 41 | ## License 42 | 43 | PXPinnedRotation is available under the MIT license. See the LICENSE file for more info. 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PXCamera 2 | 3 | [![Version](https://img.shields.io/cocoapods/v/PXCamera.svg?style=flat)](http://cocoapods.org/pods/PXCamera) 4 | [![License](https://img.shields.io/cocoapods/l/PXCamera.svg?style=flat)](http://cocoapods.org/pods/PXCamera) 5 | [![Platform](https://img.shields.io/cocoapods/p/PXCamera.svg?style=flat)](http://cocoapods.org/pods/PXCamera) 6 | 7 | ## Usage 8 | 9 | Get images from the camera or photo library with one call. No delegates, no initialization. 10 | 11 | ```objective-c 12 | [[PXCamera camera] getImageInViewController:self interface:PXCameraInterfaceCamera completion:^(UIImage * image, PXCameraImageSource source) { 13 | // boom! image and analytics data about where the image came from (camera or library) 14 | }]; 15 | 16 | // or 17 | 18 | [[PXCamera camera] getImageInViewController:self interface:PXCameraInterfaceLibrary completion:^(UIImage * image, PXCameraImageSource source) { 19 | 20 | }]; 21 | ``` 22 | 23 | If you want to get a little bit more hands-on and make your own custom camera interface but don't want to manage all the hassle of AVFoundation, check out `PXCameraCaptureManager`. This singleton provides a readonly `UIView` property `cameraPreviewView` that displays live camera output. From there, you can connect your custom UI to the other methods in the interface that allow you to control the various aspects of the camera (flash mode, preview orientation, front -facing or back-facing camera). Check out the `PXCustomCameraViewController` in the example project for a really basic example. 24 | 25 | To run the example project, clone the repo, and run `pod install` from the Example directory first. 26 | 27 | ## Installation 28 | 29 | PXCamera is available through [CocoaPods](http://cocoapods.org). To install 30 | it, simply add the following line to your Podfile: 31 | 32 | ```ruby 33 | pod "PXCamera" 34 | ``` 35 | 36 | ## Author 37 | 38 | Daniel Blakemore, DanBlakemore@gmail.com 39 | 40 | ## License 41 | 42 | PXCamera is available under the MIT license. See the LICENSE file for more info. 43 | -------------------------------------------------------------------------------- /Example/PXCamera/PXCustomCameraView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXCustomCameraView.m 3 | // PXCamera 4 | // 5 | // Created by Daniel Blakemore on 12/23/15. 6 | // Copyright © 2015 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import "PXCustomCameraView.h" 10 | 11 | #import 12 | 13 | @implementation PXCustomCameraView 14 | { 15 | UIView * _cameraView; 16 | } 17 | 18 | - (instancetype)initWithFrame:(CGRect)frame 19 | { 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | [self setBackgroundColor:[UIColor darkGrayColor]]; 23 | 24 | _cameraView = [[PXCameraCaptureManager captureManager] cameraPreviewView]; 25 | [_cameraView setBackgroundColor:[UIColor blackColor]]; 26 | [_cameraView setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 27 | [self addSubview:_cameraView]; 28 | 29 | _shutterButton = [UIButton buttonWithType:UIButtonTypeCustom]; 30 | [_shutterButton setTitle:@"Take Photo" forState:UIControlStateNormal]; 31 | [_shutterButton setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 32 | [self addSubview:_shutterButton]; 33 | 34 | NSDictionary* views = NSDictionaryOfVariableBindings(_cameraView, _shutterButton); 35 | NSDictionary* metrics = @{@"bw" : @100, @"bh" : @40, @"sp" : @20}; 36 | 37 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_cameraView]|" options:0 metrics:metrics views:views]]; 38 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_shutterButton(bw)]" options:0 metrics:metrics views:views]]; 39 | [self addConstraint:[NSLayoutConstraint constraintWithItem:_shutterButton attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]]; 40 | 41 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_cameraView]-sp-[_shutterButton(bh)]-sp-|" options:0 metrics:metrics views:views]]; 42 | } 43 | return self; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraPreviewView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraPreviewView.m 3 | // 4 | // Copyright (c) 2015 Pixio 5 | // 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files (the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions: 12 | // 13 | // The above copyright notice and this permission notice shall be included in 14 | // all copies or substantial portions of the Software. 15 | // 16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | // THE SOFTWARE. 23 | // 24 | 25 | #import "PXCameraPreviewView.h" 26 | 27 | @implementation PXCameraPreviewView 28 | 29 | - (instancetype)initWithFrame:(CGRect)frame 30 | { 31 | self = [super initWithFrame:frame]; 32 | if (self) { 33 | [[self layer] setMasksToBounds:YES]; 34 | } 35 | return self; 36 | } 37 | 38 | - (void)setPreviewLayer:(CALayer *)previewLayer 39 | { 40 | _previewLayer = previewLayer; 41 | [[self layer] insertSublayer:_previewLayer below:[[[self layer] sublayers] lastObject]]; 42 | } 43 | 44 | - (void)layoutSubviews 45 | { 46 | [super layoutSubviews]; 47 | 48 | [_previewLayer setFrame:[[self layer] bounds]]; 49 | } 50 | 51 | - (void)setFrame:(CGRect)frame 52 | { 53 | [super setFrame:frame]; 54 | 55 | [_previewLayer setFrame:[[self layer] bounds]]; 56 | } 57 | 58 | - (void)removeFromSuperview 59 | { 60 | [super removeFromSuperview]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Example/Pods/PXPinnedRotation/Pod/Classes/PXPinnedRotationViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXPinnedRotationViewController 3 | // 4 | // Created by acobb on 5/16/14. 5 | // Updated and finished by Daniel Blakemore ca. 9/26/14. 6 | // 7 | // Copyright (c) 2015 Pixio 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | #import 29 | #import 30 | 31 | @class PXPinnedRotationView; 32 | 33 | /** 34 | * PXPinnedRotationViewController is intended to be subclassed, but can also 35 | * be used without subclassing by using setView: and setting the view to be a 36 | * subclass of PXPinnedRotationView. 37 | */ 38 | @interface PXPinnedRotationViewController : UIViewController 39 | 40 | - (PXPinnedRotationView*)rotationView; 41 | 42 | /** 43 | * Block to be run when rotation begins. Will not animate as rotation animations are disabled. 44 | */ 45 | @property (nonatomic, copy) void (^onRotationBlock)(UIInterfaceOrientation newOrientation); 46 | 47 | /** 48 | * Block to run when the rotation ends. Will be animated. 49 | */ 50 | @property (nonatomic, copy) void (^postRotationBlock)(UIInterfaceOrientation newOrientation); 51 | 52 | @end -------------------------------------------------------------------------------- /Pod/Classes/PXSpanPicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXSpanPicker.h 3 | // 4 | // Created by Daniel Blakemore on 9/3/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | typedef NS_ENUM(NSInteger, PXSpanPickerOrientation) { 30 | PXSpanPickerOrientationPortrait, 31 | PXSpanPickerOrientationLandscape, 32 | }; 33 | 34 | @interface PXSpanPicker : UIControl 35 | 36 | @property (nonatomic, nullable) NSString * title; 37 | @property (nonatomic) NSInteger value; 38 | @property (nonatomic) BOOL continuous; 39 | @property (nonatomic, nullable) UIColor * contentBackgroundColor; 40 | @property (nonatomic) BOOL hidden; 41 | 42 | - (void) hideAnimated:(BOOL)animated; 43 | - (void) showAnimated:(BOOL)animated; 44 | 45 | - (void) hideText; 46 | - (void) showText; 47 | 48 | - (void) setValue:(NSInteger)value animated:(BOOL)animated; 49 | 50 | /** 51 | * Set the orirentation of the flash control to change layout to be compatible with pinned rotation. 52 | * 53 | * @param orientation the new orientation 54 | */ 55 | - (void) setOrientation:(PXSpanPickerOrientation)orientation; 56 | 57 | /** 58 | * Returns the individual views for each delay for in-place animation purposes. 59 | * 60 | * @return an array of the individual labels 61 | */ 62 | - (nonnull NSArray *) individualViews; 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /Pod/Classes/PXFlashControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXFlashButton.h 3 | // 4 | // Created by Daniel Blakemore on 10/11/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | #import "PXCameraCaptureManager.h" 30 | 31 | typedef NS_ENUM(NSInteger, PXFlashControlState) { 32 | PXFlashControlStateCollapsed, 33 | PXFlashControlStateExpanded, 34 | }; 35 | 36 | typedef NS_ENUM(NSInteger, PXFlashControlOrientation) { 37 | PXFlashControlOrientationPortrait, 38 | PXFlashControlOrientationLandscape, 39 | }; 40 | 41 | @interface PXFlashControl : UIControl 42 | 43 | @property (nonatomic) PXFlashType value; 44 | @property (nonatomic) PXFlashControlState fcState; 45 | 46 | /** 47 | * Call to set the buttons to collapsed mode. 48 | */ 49 | - (void) collapse; 50 | 51 | /** 52 | * Call to set the buttons to expanded mode. 53 | */ 54 | - (void) expand; 55 | 56 | /** 57 | * Set the orirentation of the flash control to change layout to be compatible with pinned rotation. 58 | * 59 | * @param orientation the new orientation 60 | */ 61 | - (void) setOrientation:(PXFlashControlOrientation)orientation; 62 | 63 | /** 64 | * Returns the individual views for each flash symbol for in-place animation purposes. 65 | * 66 | * @return an array of the individual image views 67 | */ 68 | - (NSArray*) individualViews; 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /Example/PXCamera/PXCustomCameraViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXCustomCameraViewController.m 3 | // PXCamera 4 | // 5 | // Created by Daniel Blakemore on 12/23/15. 6 | // Copyright © 2015 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import "PXCustomCameraViewController.h" 10 | 11 | #import "PXCustomCameraView.h" 12 | 13 | #import 14 | 15 | @implementation PXCustomCameraViewController 16 | { 17 | void (^_completion)(UIImage * image, BOOL pictureTaken); 18 | } 19 | 20 | - (instancetype)initWithCompletion:(void(^)(UIImage * image, BOOL pictureTaken))completion 21 | { 22 | self = [super init]; 23 | if (self) { 24 | _completion = completion; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)loadView 30 | { 31 | [self setView:[[PXCustomCameraView alloc] init]]; 32 | } 33 | 34 | - (PXCustomCameraView*)contentView 35 | { 36 | return (id)[self view]; 37 | } 38 | 39 | - (void)viewDidLoad 40 | { 41 | [super viewDidLoad]; 42 | if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) { 43 | self.edgesForExtendedLayout = UIRectEdgeNone; 44 | } 45 | 46 | [[[self contentView] shutterButton] addTarget:self action:@selector(shutterPressed) forControlEvents:UIControlEventTouchUpInside]; 47 | } 48 | 49 | - (void)viewWillAppear:(BOOL)animated 50 | { 51 | [super viewWillAppear:animated]; 52 | 53 | [[PXCameraCaptureManager captureManager] start]; 54 | } 55 | 56 | - (void)viewWillDisappear:(BOOL)animated 57 | { 58 | [[PXCameraCaptureManager captureManager] stop]; 59 | [super viewWillDisappear:animated]; 60 | if (_completion) { 61 | _completion(nil, FALSE); // cheap replacement for back button in camera UI 62 | _completion = nil; 63 | } 64 | } 65 | 66 | - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator 67 | { 68 | [coordinator animateAlongsideTransition:^(id _Nonnull context) { 69 | [[PXCameraCaptureManager captureManager] setCameraPreviewOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; 70 | } completion:^(id _Nonnull context) { 71 | }]; 72 | } 73 | 74 | - (void)shutterPressed 75 | { 76 | [[PXCameraCaptureManager captureManager] captureStillImageWithBlock:^(UIImage * image) { 77 | [[self navigationController] popViewControllerAnimated:TRUE]; 78 | if (_completion) { 79 | _completion(image, TRUE); 80 | _completion = nil; 81 | } 82 | }]; 83 | } 84 | 85 | @end 86 | -------------------------------------------------------------------------------- /Example/PXCamera/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "29x29", 26 | "scale" : "3x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "40x40", 36 | "scale" : "3x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "57x57", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "iphone", 45 | "size" : "57x57", 46 | "scale" : "2x" 47 | }, 48 | { 49 | "idiom" : "iphone", 50 | "size" : "60x60", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "iphone", 55 | "size" : "60x60", 56 | "scale" : "3x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "20x20", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "20x20", 66 | "scale" : "2x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "29x29", 71 | "scale" : "1x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "29x29", 76 | "scale" : "2x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "40x40", 81 | "scale" : "1x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "40x40", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ipad", 90 | "size" : "50x50", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "idiom" : "ipad", 95 | "size" : "50x50", 96 | "scale" : "2x" 97 | }, 98 | { 99 | "idiom" : "ipad", 100 | "size" : "72x72", 101 | "scale" : "1x" 102 | }, 103 | { 104 | "idiom" : "ipad", 105 | "size" : "72x72", 106 | "scale" : "2x" 107 | }, 108 | { 109 | "idiom" : "ipad", 110 | "size" : "76x76", 111 | "scale" : "1x" 112 | }, 113 | { 114 | "idiom" : "ipad", 115 | "size" : "76x76", 116 | "scale" : "2x" 117 | }, 118 | { 119 | "idiom" : "ipad", 120 | "size" : "83.5x83.5", 121 | "scale" : "2x" 122 | } 123 | ], 124 | "info" : { 125 | "version" : 1, 126 | "author" : "xcode" 127 | } 128 | } -------------------------------------------------------------------------------- /Pod/Classes/PXCameraViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraViewController.h 3 | // 4 | // Created by Daniel Blakemore on 9/17/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | #import 29 | 30 | #import "PXCamera.h" 31 | 32 | #import 33 | 34 | @interface PXCameraViewController : PXPinnedRotationViewController 35 | 36 | /** 37 | * Shared singleton view controller to use. 38 | */ 39 | + (PXCameraViewController*)sharedCamera; 40 | 41 | /** 42 | * The text for the shutter delay in the camera. The default is @"shutter delay". 43 | */ 44 | @property (nonatomic) NSString * shutterDelayText; 45 | 46 | /** 47 | * Get an image using the camera and report back when done. 48 | * 49 | * The completion you specify also takes a completion as an argument. This second block should be 50 | * called when you are ready to dismiss the spinner in the camera. 51 | * 52 | * @param vc the presenting view controller for the camera 53 | * @param completion a completion called with the resulting image, the source, and a block to call when it's complete 54 | */ 55 | + (void)getImageInViewController:(UIViewController*)vc completion:(void(^)(UIImage*, PXCameraImageSource, void (^completion)()))completion; 56 | 57 | /** 58 | * Set completion for image capture. Caller is responsible for navigation stack 59 | * 60 | * @param completion block to call when image is captured 61 | */ 62 | - (void)setCompletion:(void (^)(UIImage*, PXCameraImageSource, void (^completion)()))completion; 63 | 64 | - (instancetype)init __attribute__((unavailable("use the singleton"))); 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /Example/PXCamera/PXAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXAppDelegate.m 3 | // PXCamera 4 | // 5 | // Created by CocoaPods on 05/01/2015. 6 | // Copyright (c) 2014 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import "PXAppDelegate.h" 10 | 11 | #import "PXExampleViewController.h" 12 | 13 | #import 14 | 15 | @implementation PXAppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | // Override point for customization after application launch. 20 | [self setWindow:[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]]; 21 | [[self window] makeKeyAndVisible]; 22 | [[self window] setBackgroundColor:[UIColor whiteColor]]; 23 | 24 | // Create the controllers 25 | PXExampleViewController* controller = [[PXExampleViewController alloc] init]; 26 | UINavigationController* navController = [[UINavigationController alloc] initWithRootViewController:controller]; 27 | [[self window] setRootViewController:navController]; 28 | 29 | // construct things early since the image library thing is slow to load 30 | [PXCamera camera]; 31 | 32 | return YES; 33 | } 34 | 35 | - (void)applicationWillResignActive:(UIApplication *)application 36 | { 37 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 38 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 39 | } 40 | 41 | - (void)applicationDidEnterBackground:(UIApplication *)application 42 | { 43 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 44 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 45 | } 46 | 47 | - (void)applicationWillEnterForeground:(UIApplication *)application 48 | { 49 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 50 | } 51 | 52 | - (void)applicationDidBecomeActive:(UIApplication *)application 53 | { 54 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 55 | } 56 | 57 | - (void)applicationWillTerminate:(UIApplication *)application 58 | { 59 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Pod/Classes/PXImagePickerHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXImagePickerHelper.h 3 | // 4 | // Created by Daniel Blakemore on 9/27/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | #import "PXCamera.h" 30 | 31 | /** 32 | * Helper class for interfacing with UIImagePickerController. 33 | */ 34 | @interface PXImagePickerHelper : NSObject 35 | 36 | /** 37 | * The color used for the buttons and titles in the navigation bar. 38 | * The default is @c blackColor. 39 | */ 40 | @property (nonatomic, nullable) UIColor * tintColor; 41 | 42 | /** 43 | * The bar color used in the navigation bar. The default color is whiteColor; 44 | */ 45 | @property (nonatomic, nullable) UIColor * barTintColor; 46 | 47 | /** 48 | * Image picker controller that backs the helper. 49 | */ 50 | @property (nonatomic, nonnull) UIImagePickerController * imagePickerController; 51 | 52 | /** 53 | * Completion to call with 54 | */ 55 | @property (nonatomic, copy, nullable) void(^completion)(UIImage* _Nullable, PXCameraImageSource); 56 | 57 | /** 58 | * Generate the singleton. This allows you to generate the singleton ahead of 59 | * time so it doesn't hang when the user accesses the photo library first time. 60 | * 61 | * @return a singleton with no exposed methods 62 | */ 63 | + (nonnull PXImagePickerHelper*)sharedHelper; 64 | 65 | /** 66 | * Get an image asynchronously from the camera, library, or web. Calls the completion when an image is picked or picking is canceled. 67 | * 68 | * @param vc the view controller with which to present the image 69 | * @param completion a block to run with the retrieved image 70 | */ 71 | + (void)getImageInViewController:(nonnull UIViewController*)vc completion:(nullable void(^)(UIImage* _Nullable, PXCameraImageSource))completion; 72 | 73 | @end 74 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraDisplayView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraDisplayView.m 3 | // 4 | // Created by Daniel Blakemore on 8/21/15. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "PXCameraDisplayView.h" 28 | 29 | #import "PXCameraGridLayer.h" 30 | #import "PXCameraCaptureManager.h" 31 | 32 | @implementation PXCameraDisplayView 33 | { 34 | PXCameraGridLayer * _gridLayer; 35 | 36 | UIView * _cameraPreview; 37 | } 38 | 39 | - (instancetype)initWithFrame:(CGRect)frame 40 | { 41 | self = [super initWithFrame:(CGRect)frame]; 42 | if (self) { 43 | [self setClipsToBounds:TRUE]; 44 | 45 | _cameraPreview = [[PXCameraCaptureManager captureManager] cameraPreviewView]; 46 | [_cameraPreview setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 47 | [self addSubview:_cameraPreview]; 48 | 49 | _gridLayer = [[PXCameraGridLayer alloc] init]; 50 | [_gridLayer setSpeed:1000]; 51 | [[self layer] addSublayer:_gridLayer]; 52 | } 53 | return self; 54 | } 55 | 56 | - (void)updateConstraints 57 | { 58 | NSDictionary* views = NSDictionaryOfVariableBindings(_cameraPreview); 59 | NSDictionary* metrics = @{}; 60 | 61 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_cameraPreview]|" options:0 metrics:metrics views:views]]; 62 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_cameraPreview]|" options:0 metrics:metrics views:views]]; 63 | 64 | [super updateConstraints]; 65 | } 66 | 67 | - (void)layoutSublayersOfLayer:(CALayer *)layer 68 | { 69 | [super layoutSublayersOfLayer:layer]; 70 | if ([layer isEqual:[self layer]]) { 71 | [_gridLayer setFrame:[layer bounds]]; 72 | } 73 | } 74 | 75 | - (BOOL)gridHidden 76 | { 77 | return [_gridLayer gridHidden]; 78 | } 79 | 80 | - (void)setGridHidden:(BOOL)gridHidden 81 | { 82 | [_gridLayer setGridHidden:gridHidden]; 83 | } 84 | 85 | - (void)ensureCameraPreviewViewAttached 86 | { 87 | if (![[_cameraPreview superview] isEqual:self]) { 88 | [self addSubview:_cameraPreview]; 89 | } 90 | } 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraGridLayer.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraDisplayView.m 3 | // 4 | // Created by Daniel Blakemore on 8/14/15. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "PXCameraGridLayer.h" 28 | 29 | @implementation PXCameraGridLayer 30 | 31 | - (instancetype)init 32 | { 33 | self = [super init]; 34 | if (self) { 35 | _gridHidden = TRUE; 36 | } 37 | return self; 38 | } 39 | 40 | - (void)setGridHidden:(BOOL)gridHidden 41 | { 42 | _gridHidden = gridHidden; 43 | [self setNeedsDisplay]; 44 | } 45 | 46 | - (void)drawInContext:(CGContextRef)ctx 47 | { 48 | if (_gridHidden) { 49 | return; 50 | } 51 | CGRect rect = [self frame]; 52 | 53 | CGContextClearRect(ctx, rect); 54 | 55 | CGContextSetShadowWithColor(ctx, CGSizeZero, 0.5, [[UIColor grayColor] CGColor]); 56 | 57 | CGMutablePathRef linePath = CGPathCreateMutable(); 58 | 59 | void (^drawLine)(CGPoint, CGPoint) = ^(CGPoint start, CGPoint end) { 60 | CGPathMoveToPoint(linePath, NULL, start.x, start.y); 61 | CGPathAddLineToPoint(linePath, NULL, end.x, end.y); 62 | }; 63 | 64 | static const int xDivisions = 4; 65 | for (int i = 1; i < xDivisions - 1; i++) { 66 | CGFloat xValue = i / (double)(xDivisions - 1) * rect.size.width; 67 | CGPoint start = CGPointMake(xValue, 0); 68 | CGPoint end = CGPointMake(xValue, rect.size.height); 69 | drawLine(start, end); 70 | } 71 | 72 | static const int yDivisions = 4; 73 | for (int i = 1; i < yDivisions - 1; i++) { 74 | CGFloat yValue = i / (double)(yDivisions - 1) * rect.size.height; 75 | CGPoint start = CGPointMake(0, yValue); 76 | CGPoint end = CGPointMake(rect.size.width, yValue); 77 | drawLine(start, end); 78 | } 79 | 80 | // set thick gray 81 | CGContextSetLineWidth(ctx, 1.0f); 82 | CGContextSetStrokeColorWithColor(ctx, [[UIColor grayColor] CGColor]); 83 | CGContextAddPath(ctx, linePath); 84 | CGContextStrokePath(ctx); 85 | 86 | // set thin white 87 | CGContextSetLineWidth(ctx, 0.5f); 88 | CGContextSetStrokeColorWithColor(ctx, [[UIColor whiteColor] CGColor]); 89 | CGContextAddPath(ctx, linePath); 90 | CGContextStrokePath(ctx); 91 | CGPathRelease(linePath); 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraView.h 3 | // 4 | // Created by Daniel Blakemore on 9/11/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | #import "PXSpanPicker.h" 30 | #import "PXFlashControl.h" 31 | #import "PXCameraButton.h" 32 | #import "PXLibraryButton.h" 33 | #import "PXCameraGridLayer.h" 34 | 35 | #import 36 | 37 | typedef NS_ENUM(NSInteger, PXCameraViewType) { // NSAlrightyThen 38 | PXCameraViewTypeCamera = 0, 39 | PXCameraViewTypePreview, 40 | }; 41 | 42 | /** 43 | * View displaying the camera preview and controls. 44 | */ 45 | @interface PXCameraView : PXPinnedRotationView 46 | 47 | /** 48 | * Picker for picking the shutter delay 49 | */ 50 | @property (nonatomic, readonly, nonnull) PXSpanPicker * spanPicker; 51 | 52 | /** 53 | * Button for choosing flash mode. 54 | */ 55 | @property (nonatomic, readonly, nonnull) PXFlashControl * flashButton; 56 | 57 | /** 58 | * Button to switch camera from front-facing to back-facing. 59 | */ 60 | @property (nonatomic, readonly, nonnull) UIButton * switchCamera; 61 | 62 | /** 63 | * Display grid overlay. 64 | */ 65 | @property (nonatomic, readonly, nonnull) UIButton * gridButton; 66 | 67 | /** 68 | * Button for opening the photo library. 69 | */ 70 | @property (nonatomic, readonly, nonnull) PXLibraryButton * photoLibrary; 71 | 72 | /** 73 | * Shutter button. 74 | */ 75 | @property (nonatomic, readonly, nonnull) PXCameraButton * takePhoto; 76 | 77 | /** 78 | * Button to return to the previous view. 79 | */ 80 | @property (nonatomic, readonly, nonnull) UIButton * backButton; 81 | 82 | /** 83 | * A view showing the captured image after it has been taken from the camera while processing occurs. 84 | */ 85 | @property (nonatomic, readonly, nonnull) UIImageView * imagePreview; 86 | 87 | /** 88 | * Live preview of camera feed. 89 | */ 90 | @property (nonatomic, readonly, nonnull) UIView * cameraView; 91 | 92 | /** 93 | * The state of the camera view. 94 | */ 95 | @property (nonatomic) PXCameraViewType state; 96 | 97 | - (nonnull id) init; 98 | 99 | - (void) reset; 100 | - (void) flash; 101 | - (void) flashOn; 102 | - (void) flashOff; 103 | 104 | - (void) ensureValidCameraView; 105 | 106 | - (void) setFlashType:(PXFlashType)flashType; 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PXCamera/Pods-PXCamera-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 5 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 6 | 7 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 8 | 9 | install_framework() 10 | { 11 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 12 | local source="${BUILT_PRODUCTS_DIR}/$1" 13 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 14 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 15 | elif [ -r "$1" ]; then 16 | local source="$1" 17 | fi 18 | 19 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | 21 | if [ -L "${source}" ]; then 22 | echo "Symlinked..." 23 | source="$(readlink "${source}")" 24 | fi 25 | 26 | # use filter instead of exclude so missing patterns dont' throw errors 27 | echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 28 | rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 29 | 30 | local basename 31 | basename="$(basename -s .framework "$1")" 32 | binary="${destination}/${basename}.framework/${basename}" 33 | if ! [ -r "$binary" ]; then 34 | binary="${destination}/${basename}" 35 | fi 36 | 37 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 38 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 39 | strip_invalid_archs "$binary" 40 | fi 41 | 42 | # Resign the code if required by the build settings to avoid unstable apps 43 | code_sign_if_enabled "${destination}/$(basename "$1")" 44 | 45 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 46 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 47 | local swift_runtime_libs 48 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 49 | for lib in $swift_runtime_libs; do 50 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 51 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 52 | code_sign_if_enabled "${destination}/${lib}" 53 | done 54 | fi 55 | } 56 | 57 | # Signs a framework with the provided identity 58 | code_sign_if_enabled() { 59 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 60 | # Use the current code_sign_identitiy 61 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 62 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" 63 | 64 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 65 | code_sign_cmd="$code_sign_cmd &" 66 | fi 67 | echo "$code_sign_cmd" 68 | eval "$code_sign_cmd" 69 | fi 70 | } 71 | 72 | # Strip invalid architectures 73 | strip_invalid_archs() { 74 | binary="$1" 75 | # Get architectures for current file 76 | archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" 77 | stripped="" 78 | for arch in $archs; do 79 | if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then 80 | # Strip non-valid architectures in-place 81 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 82 | stripped="$stripped $arch" 83 | fi 84 | done 85 | if [[ "$stripped" ]]; then 86 | echo "Stripped $binary of architectures:$stripped" 87 | fi 88 | } 89 | 90 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 91 | wait 92 | fi 93 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## PXCamera 5 | 6 | Copyright (c) 2015 Daniel Blakemore 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## PXPinnedRotation 28 | 29 | Copyright (c) 2015 Daniel Blakemore 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining a copy 32 | of this software and associated documentation files (the "Software"), to deal 33 | in the Software without restriction, including without limitation the rights 34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 35 | copies of the Software, and to permit persons to whom the Software is 36 | furnished to do so, subject to the following conditions: 37 | 38 | The above copyright notice and this permission notice shall be included in 39 | all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 47 | THE SOFTWARE. 48 | 49 | 50 | ## SVProgressHUD 51 | 52 | Copyright (c) 2011-2014 Sam Vermette 53 | 54 | Permission is hereby granted, free of charge, to any person 55 | obtaining a copy of this software and associated documentation 56 | files (the "Software"), to deal in the Software without 57 | restriction, including without limitation the rights to use, 58 | copy, modify, merge, publish, distribute, sublicense, and/or sell 59 | copies of the Software, and to permit persons to whom the 60 | Software is furnished to do so, subject to the following 61 | conditions: 62 | 63 | The above copyright notice and this permission notice shall be 64 | included in all copies or substantial portions of the Software. 65 | 66 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 67 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 68 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 69 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 70 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 71 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 72 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 73 | OTHER DEALINGS IN THE SOFTWARE. 74 | 75 | A different license may apply to other resources included in this package, 76 | including Freepik Icons. Please consult their 77 | respective headers for the terms of their individual licenses. 78 | Generated by CocoaPods - https://cocoapods.org 79 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PXCamera/Pods-PXCamera-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## PXCamera 5 | 6 | Copyright (c) 2015 Daniel Blakemore 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | 26 | 27 | ## PXPinnedRotation 28 | 29 | Copyright (c) 2015 Daniel Blakemore 30 | 31 | Permission is hereby granted, free of charge, to any person obtaining a copy 32 | of this software and associated documentation files (the "Software"), to deal 33 | in the Software without restriction, including without limitation the rights 34 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 35 | copies of the Software, and to permit persons to whom the Software is 36 | furnished to do so, subject to the following conditions: 37 | 38 | The above copyright notice and this permission notice shall be included in 39 | all copies or substantial portions of the Software. 40 | 41 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 42 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 43 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 44 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 45 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 46 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 47 | THE SOFTWARE. 48 | 49 | 50 | ## SVProgressHUD 51 | 52 | Copyright (c) 2011-2014 Sam Vermette 53 | 54 | Permission is hereby granted, free of charge, to any person 55 | obtaining a copy of this software and associated documentation 56 | files (the "Software"), to deal in the Software without 57 | restriction, including without limitation the rights to use, 58 | copy, modify, merge, publish, distribute, sublicense, and/or sell 59 | copies of the Software, and to permit persons to whom the 60 | Software is furnished to do so, subject to the following 61 | conditions: 62 | 63 | The above copyright notice and this permission notice shall be 64 | included in all copies or substantial portions of the Software. 65 | 66 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 67 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 68 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 69 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 70 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 71 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 72 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 73 | OTHER DEALINGS IN THE SOFTWARE. 74 | 75 | A different license may apply to other resources included in this package, 76 | including Freepik Icons. Please consult their 77 | respective headers for the terms of their individual licenses. 78 | Generated by CocoaPods - https://cocoapods.org 79 | -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVProgressHUD.h 3 | // 4 | // Copyright 2011-2014 Sam Vermette. All rights reserved. 5 | // 6 | // https://github.com/samvermette/SVProgressHUD 7 | // 8 | 9 | #import 10 | #import 11 | 12 | extern NSString * const SVProgressHUDDidReceiveTouchEventNotification; 13 | extern NSString * const SVProgressHUDDidTouchDownInsideNotification; 14 | extern NSString * const SVProgressHUDWillDisappearNotification; 15 | extern NSString * const SVProgressHUDDidDisappearNotification; 16 | extern NSString * const SVProgressHUDWillAppearNotification; 17 | extern NSString * const SVProgressHUDDidAppearNotification; 18 | 19 | extern NSString * const SVProgressHUDStatusUserInfoKey; 20 | 21 | typedef NS_ENUM(NSUInteger, SVProgressHUDMaskType) { 22 | SVProgressHUDMaskTypeNone = 1, // allow user interactions while HUD is displayed 23 | SVProgressHUDMaskTypeClear, // don't allow user interactions 24 | SVProgressHUDMaskTypeBlack, // don't allow user interactions and dim the UI in the back of the HUD 25 | SVProgressHUDMaskTypeGradient // don't allow user interactions and dim the UI with a a-la-alert-view background gradient 26 | }; 27 | 28 | @interface SVProgressHUD : UIView 29 | 30 | #pragma mark - Customization 31 | 32 | + (void)setBackgroundColor:(UIColor*)color; // default is [UIColor whiteColor] 33 | + (void)setForegroundColor:(UIColor*)color; // default is [UIColor blackColor] 34 | + (void)setRingThickness:(CGFloat)width; // default is 4 pt 35 | + (void)setFont:(UIFont*)font; // default is [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline] 36 | + (void)setInfoImage:(UIImage*)image; // default is the bundled info image provided by Freepik 37 | + (void)setSuccessImage:(UIImage*)image; // default is the bundled success image provided by Freepik 38 | + (void)setErrorImage:(UIImage*)image; // default is the bundled error image provided by Freepik 39 | + (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType; // default is SVProgressHUDMaskTypeNone 40 | + (void)setViewForExtension:(UIView*)view; // default is nil, only used if #define SV_APP_EXTENSIONS is set 41 | 42 | #pragma mark - Show Methods 43 | 44 | + (void)show; 45 | + (void)showWithMaskType:(SVProgressHUDMaskType)maskType; 46 | + (void)showWithStatus:(NSString*)status; 47 | + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 48 | 49 | + (void)showProgress:(float)progress; 50 | + (void)showProgress:(float)progress maskType:(SVProgressHUDMaskType)maskType; 51 | + (void)showProgress:(float)progress status:(NSString*)status; 52 | + (void)showProgress:(float)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 53 | 54 | + (void)setStatus:(NSString*)string; // change the HUD loading status while it's showing 55 | 56 | // stops the activity indicator, shows a glyph + status, and dismisses HUD a little bit later 57 | + (void)showInfoWithStatus:(NSString *)string; 58 | + (void)showInfoWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType; 59 | 60 | + (void)showSuccessWithStatus:(NSString*)string; 61 | + (void)showSuccessWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType; 62 | 63 | + (void)showErrorWithStatus:(NSString *)string; 64 | + (void)showErrorWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType; 65 | 66 | // use 28x28 white pngs 67 | + (void)showImage:(UIImage*)image status:(NSString*)status; 68 | + (void)showImage:(UIImage*)image status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 69 | 70 | + (void)setOffsetFromCenter:(UIOffset)offset; 71 | + (void)resetOffsetFromCenter; 72 | 73 | + (void)popActivity; // decrease activity count, if activity count == 0 the HUD is dismissed 74 | + (void)dismiss; 75 | 76 | + (BOOL)isVisible; 77 | 78 | @end 79 | 80 | -------------------------------------------------------------------------------- /Example/Pods/PXPinnedRotation/Pod/Classes/PXPinnedRotationView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXPinnedRotationView 3 | // 4 | // Created by acobb on 5/16/14. 5 | // Updated and finished by Daniel Blakemore ca. 9/26/14. 6 | // 7 | // Copyright (c) 2015 Pixio 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | #import 29 | #import 30 | 31 | 32 | /** 33 | * PXPinnedRotationView is the root view that allows subviews to be pinned. 34 | * This class is intended to be subclassed. Subclasses should override 35 | * calculateBaseConstraintsBeforeLayoutPass to setup constraints. The view 36 | * should be set as the view of a PXPinnedRotationViewController. 37 | * 38 | * @seealso PXPinnedRotationViewController 39 | * @seealso calculateBaseConstraintsBeforeLayoutPass 40 | */ 41 | @interface PXPinnedRotationView : UIView 42 | 43 | @property(nonatomic) UIInterfaceOrientation orientation; 44 | 45 | /** 46 | * List of views that will be pinned. 47 | * 48 | * @seealso addViewToAnimate: 49 | * @seealso addViewsToAnimate: 50 | */ 51 | @property (nonatomic, readonly) NSArray * viewsToAnimateRotation; 52 | 53 | - (void)addViewToAnimate:(UIView*)view; 54 | - (void)addViewsToAnimate:(NSArray*)views; 55 | - (void)removeViewToAnimate:(UIView*)view; 56 | 57 | /** 58 | * Calculate all view contraints outside of the UIKit update/layout loop. 59 | * 60 | * Subclasses should use this method instead of update contraints for efficient and correct 61 | * pinned rotation. There is no need to call super. 62 | * 63 | * Constraints returned by this method are not guaranteed to survive the layout process. 64 | * To keep an up-to-date reference to a constraint (to change it's constant for example) 65 | * use method -registerUpdateHandler:forConstraint:. 66 | * 67 | * @see -registerUpdateHandler:forConstraint: 68 | * 69 | * @return an array of all constraints for the view. 70 | */ 71 | - (NSArray*)calculateBaseConstraintsBeforeLayoutPass; 72 | 73 | /** 74 | * Manually trigger constraint generation and layout. 75 | * 76 | * This should be done after subclasses init is finished. 77 | */ 78 | - (void)manuallyStartLayoutPass; 79 | 80 | /** 81 | * Registers an update handler to let the caller know when a constraint has been rebuilt for pinned rotation. 82 | * 83 | * Constraints for which references need to be kept to change them after layout should have handlers registered 84 | * to provide the caller with the most up-to-date pointer to the constraint. 85 | * 86 | * @param updateHandler a block called any time the constraint is rebuilt 87 | * @param constraint the initial constraint to track 88 | * @param identifier a string to uniquely identify this constraint (with respect to others the caller may also register handlers for) 89 | */ 90 | - (void)registerUpdateHandler:(void (^)(NSLayoutConstraint * constraint))updateHandler forConstraint:(NSLayoutConstraint*)constraint identifier:(NSString*)identifier; 91 | 92 | @end -------------------------------------------------------------------------------- /Example/PXCamera/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "orientation" : "portrait", 11 | "idiom" : "iphone", 12 | "extent" : "full-screen", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "orientation" : "portrait", 17 | "idiom" : "iphone", 18 | "extent" : "full-screen", 19 | "subtype" : "retina4", 20 | "scale" : "2x" 21 | }, 22 | { 23 | "orientation" : "portrait", 24 | "idiom" : "ipad", 25 | "extent" : "to-status-bar", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "orientation" : "portrait", 30 | "idiom" : "ipad", 31 | "extent" : "full-screen", 32 | "scale" : "1x" 33 | }, 34 | { 35 | "orientation" : "landscape", 36 | "idiom" : "ipad", 37 | "extent" : "to-status-bar", 38 | "scale" : "1x" 39 | }, 40 | { 41 | "orientation" : "landscape", 42 | "idiom" : "ipad", 43 | "extent" : "full-screen", 44 | "scale" : "1x" 45 | }, 46 | { 47 | "orientation" : "portrait", 48 | "idiom" : "ipad", 49 | "extent" : "to-status-bar", 50 | "scale" : "2x" 51 | }, 52 | { 53 | "orientation" : "portrait", 54 | "idiom" : "ipad", 55 | "extent" : "full-screen", 56 | "scale" : "2x" 57 | }, 58 | { 59 | "orientation" : "landscape", 60 | "idiom" : "ipad", 61 | "extent" : "to-status-bar", 62 | "scale" : "2x" 63 | }, 64 | { 65 | "orientation" : "landscape", 66 | "idiom" : "ipad", 67 | "extent" : "full-screen", 68 | "scale" : "2x" 69 | }, 70 | { 71 | "orientation" : "portrait", 72 | "idiom" : "iphone", 73 | "extent" : "full-screen", 74 | "minimum-system-version" : "8.0", 75 | "subtype" : "736h", 76 | "scale" : "3x" 77 | }, 78 | { 79 | "orientation" : "landscape", 80 | "idiom" : "iphone", 81 | "extent" : "full-screen", 82 | "minimum-system-version" : "8.0", 83 | "subtype" : "736h", 84 | "scale" : "3x" 85 | }, 86 | { 87 | "orientation" : "portrait", 88 | "idiom" : "iphone", 89 | "extent" : "full-screen", 90 | "minimum-system-version" : "8.0", 91 | "subtype" : "667h", 92 | "scale" : "2x" 93 | }, 94 | { 95 | "orientation" : "portrait", 96 | "idiom" : "ipad", 97 | "extent" : "full-screen", 98 | "minimum-system-version" : "8.0", 99 | "subtype" : "1366h", 100 | "scale" : "2x" 101 | }, 102 | { 103 | "orientation" : "portrait", 104 | "idiom" : "iphone", 105 | "extent" : "full-screen", 106 | "minimum-system-version" : "7.0", 107 | "scale" : "2x" 108 | }, 109 | { 110 | "orientation" : "portrait", 111 | "idiom" : "iphone", 112 | "extent" : "full-screen", 113 | "minimum-system-version" : "7.0", 114 | "subtype" : "retina4", 115 | "scale" : "2x" 116 | }, 117 | { 118 | "orientation" : "portrait", 119 | "idiom" : "ipad", 120 | "extent" : "full-screen", 121 | "minimum-system-version" : "7.0", 122 | "scale" : "1x" 123 | }, 124 | { 125 | "orientation" : "landscape", 126 | "idiom" : "ipad", 127 | "extent" : "full-screen", 128 | "minimum-system-version" : "7.0", 129 | "scale" : "1x" 130 | }, 131 | { 132 | "orientation" : "portrait", 133 | "idiom" : "ipad", 134 | "extent" : "full-screen", 135 | "minimum-system-version" : "7.0", 136 | "scale" : "2x" 137 | }, 138 | { 139 | "orientation" : "landscape", 140 | "idiom" : "ipad", 141 | "extent" : "full-screen", 142 | "minimum-system-version" : "7.0", 143 | "scale" : "2x" 144 | } 145 | ], 146 | "info" : { 147 | "version" : 1, 148 | "author" : "xcode" 149 | } 150 | } -------------------------------------------------------------------------------- /Pod/Classes/PXCameraCaptureManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraCaptureManager.h 3 | // Pixio 4 | // 5 | // Created by Daniel Blakemore on 9/18/13. 6 | // 7 | // Copyright (c) 2015 Pixio 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | #import 29 | #import 30 | 31 | typedef NS_ENUM(NSInteger, PXFlashType) { 32 | PXFlashTypeAuto, 33 | PXFlashTypeOn, 34 | PXFlashTypeOff, 35 | PXFlashTypeUnavailable, 36 | }; 37 | 38 | @protocol PXCameraCaptureManagerDelegate; 39 | 40 | @interface PXCameraCaptureManager : NSObject 41 | 42 | /** 43 | * Shared singleton. 44 | */ 45 | + (nonnull instancetype) captureManager; 46 | 47 | /** 48 | * The flash mode to use. 49 | */ 50 | @property (nonatomic) PXFlashType flashType; 51 | 52 | /** 53 | * A view that displays the current camera output. 54 | */ 55 | @property (nonatomic, readonly, nonnull) UIView * cameraPreviewView; 56 | 57 | /** 58 | * The orientation of the camera interface. This dictates the orientation of the video output into the preview view. 59 | * If your camera supports rotation, set this as your interface rotates. 60 | */ 61 | @property (nonatomic) UIInterfaceOrientation cameraPreviewOrientation; 62 | 63 | /** 64 | * Delegate called for various events. 65 | */ 66 | @property (nonatomic, weak, nullable) id delegate; 67 | 68 | /** 69 | * Switch the cameras (front to back, back to front) 70 | * 71 | * @return whether the cameras switched 72 | */ 73 | - (BOOL) toggleCamera; 74 | 75 | /** 76 | * Whether or not flash is supported by the current camera. This may change after a call to @c -toggleCamera. 77 | */ 78 | - (BOOL) isFlashSupported; 79 | 80 | /** 81 | * Start the camera capture. This starts getting camera data and playing it back in the preview view. 82 | */ 83 | - (void) start; 84 | 85 | /** 86 | * Stop the camera capture. This stops the camera preview view from updating. 87 | * You should stop the capture manager whenever it is not visible to save battery life. 88 | */ 89 | - (void) stop; 90 | 91 | /** 92 | * Capture an image from the camera. 93 | * 94 | * @param block a block called with the captured image. 95 | */ 96 | - (void) captureStillImageWithBlock:(nullable void(^)(UIImage* _Nullable))block; 97 | 98 | - (nullable instancetype) init __attribute__((unavailable("use the singleton"))); 99 | 100 | @end 101 | 102 | /** 103 | * These delegate methods can be called on any arbitrary thread. If the delegate does something with the UI when called, make sure to send it to the main thread. 104 | */ 105 | @protocol PXCameraCaptureManagerDelegate 106 | @optional 107 | - (void) captureManager:(nonnull PXCameraCaptureManager *)captureManager didFailWithError:(nullable NSError *)error; 108 | - (void) captureManagerStillImageCaptured:(nonnull PXCameraCaptureManager *)captureManager; 109 | - (void) captureManagerDeviceConfigurationChanged:(nonnull PXCameraCaptureManager *)captureManager; 110 | @end 111 | -------------------------------------------------------------------------------- /Pod/Classes/PXCameraButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXCameraButton.m 3 | // 4 | // Created by Daniel Blakemore on 9/11/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "PXCameraButton.h" 28 | 29 | @implementation PXCameraButton 30 | { 31 | NSString * _countDown; 32 | } 33 | 34 | - (id)initWithFrame:(CGRect)frame 35 | { 36 | self = [super initWithFrame:frame]; 37 | if (self) { 38 | // Initialization code 39 | _countDown = @""; 40 | } 41 | return self; 42 | } 43 | 44 | - (void)setHighlighted:(BOOL)highlighted 45 | { 46 | [super setHighlighted:highlighted]; 47 | 48 | [self setNeedsDisplay]; 49 | } 50 | 51 | - (NSString *)countDown 52 | { 53 | return _countDown; 54 | } 55 | 56 | - (void)setCountDown:(NSString *)countDown 57 | { 58 | _countDown = countDown; 59 | [self setNeedsDisplay]; 60 | } 61 | 62 | // Only override drawRect: if you perform custom drawing. 63 | // An empty implementation adversely affects performance during animation. 64 | - (void)drawRect:(CGRect)rect 65 | { 66 | // Drawing code 67 | CGContextRef context = UIGraphicsGetCurrentContext(); 68 | 69 | CGFloat minDimm; 70 | CGFloat newX; 71 | CGFloat newY; 72 | if (rect.size.width < rect.size.height) { 73 | minDimm = rect.size.width; 74 | newX = rect.origin.x; 75 | newY = rect.origin.y + ((rect.size.height - minDimm) / 2); 76 | } else { 77 | minDimm = rect.size.height; 78 | newX = rect.origin.x + ((rect.size.width - minDimm) / 2); 79 | newY = rect.origin.y; 80 | } 81 | 82 | CGRect innerSquare = CGRectMake(newX, newY, minDimm, minDimm); 83 | 84 | // draw button 85 | CGContextClearRect(context, rect); // clear da screen 86 | [[UIColor clearColor] setFill]; 87 | CGContextFillRect(context, rect); 88 | 89 | // draw da circle on da outzide 90 | [[UIColor whiteColor] setStroke]; 91 | CGContextSetLineWidth(context, 3.0f); 92 | CGContextStrokeEllipseInRect(context, CGRectInset(innerSquare, 1.5, 1.5)); 93 | 94 | // innar cirkle 95 | if ([self isHighlighted]) { 96 | [[UIColor darkGrayColor] setFill]; 97 | } else { 98 | [[UIColor whiteColor] setFill]; 99 | } 100 | CGContextFillEllipseInRect(context, CGRectInset(innerSquare, 5, 5)); 101 | 102 | // cut out text n shit 103 | CGContextSaveGState(context); 104 | UIFont * daFont; //.com 105 | daFont = [UIFont boldSystemFontOfSize:49]; 106 | CGSize sizeOfFont = [_countDown sizeWithAttributes:@{NSFontAttributeName : daFont}]; 107 | 108 | // translate to center font 109 | CGContextTranslateCTM(context, (innerSquare.size.width - sizeOfFont.width) / 2, (innerSquare.size.height - sizeOfFont.height) / 2); 110 | 111 | [[UIColor clearColor] setFill]; 112 | CGContextSetBlendMode(context, kCGBlendModeCopy); 113 | [_countDown drawInRect:innerSquare withAttributes:@{NSFontAttributeName : daFont}]; 114 | CGContextRestoreGState(context); 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /Example/PXCamera.xcodeproj/xcshareddata/xcschemes/PXCamera-Example.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 64 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 85 | 91 | 92 | 93 | 94 | 96 | 97 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Pod/Classes/PXCamera.h: -------------------------------------------------------------------------------- 1 | // 2 | // PXCamera.h 3 | // 4 | // Created by Daniel Blakemore on 8/21/15. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import 28 | 29 | /** 30 | * The different image sources from which images can be retrieved. 31 | */ 32 | typedef NS_ENUM(NSInteger, PXCameraInterface){ 33 | /** 34 | * Get a photo from the library using the standard @c UIImagePickerController UI. 35 | */ 36 | PXCameraInterfaceLibrary, 37 | /** 38 | * Get a photo from the camera using a custom camera interface. 39 | */ 40 | PXCameraInterfaceCamera, 41 | }; 42 | 43 | /** 44 | * The final source of the image returned. 45 | */ 46 | typedef NS_ENUM(NSInteger, PXCameraImageSource){ 47 | /** 48 | * The image was selected from the photo library. 49 | */ 50 | PXCameraImageSourceLibrary, 51 | /** 52 | * The image was taken from the camera. 53 | */ 54 | PXCameraImageSourceCamera, 55 | /** 56 | * No image was retrieved. 57 | */ 58 | PXCameraImageSourceNone, 59 | }; 60 | 61 | /** 62 | * The authorization status of the image sources (camera or library). 63 | */ 64 | typedef NS_ENUM(NSInteger, PXCameraAuthorizationStatus) { 65 | /** 66 | * The user hasn't been asked yet. 67 | */ 68 | PXCameraAuthorizationStatusNotDetermined, 69 | /** 70 | * The user can't use the image source and can't change that fact. 71 | */ 72 | PXCameraAuthorizationStatusRestricted, 73 | /** 74 | * The user said no when you asked. 75 | */ 76 | PXCameraAuthorizationStatusDenied, 77 | /** 78 | * The user said yes when you asked. 79 | */ 80 | PXCameraAuthorizationStatusAuthorized, 81 | }; 82 | 83 | /** 84 | * Central class for interfacing with all the various image classes (camera, library). 85 | */ 86 | @interface PXCamera : NSObject 87 | 88 | /** 89 | * Shared singleton. 90 | */ 91 | + (nonnull instancetype) camera; 92 | 93 | /** 94 | * The authorization state of the camera. 95 | */ 96 | - (PXCameraAuthorizationStatus) cameraAuthorized; 97 | 98 | /** 99 | * The authorization state of the photo library. 100 | */ 101 | - (PXCameraAuthorizationStatus) photosAuthorized; 102 | 103 | #pragma mark - Configurable Properties 104 | #pragma mark Photo Library 105 | 106 | /** 107 | * The color used for the buttons and titles in the navigation bars. 108 | * The default is @c blackColor. 109 | */ 110 | @property (nonatomic, nullable) UIColor * tintColor; 111 | 112 | /** 113 | * The bar color used in the navigation bars. The default color is whiteColor; 114 | */ 115 | @property (nonatomic, nullable) UIColor * barTintColor; 116 | 117 | #pragma mark Camera 118 | 119 | /** 120 | * The text for the shutter delay in the camera. The default is @"shutter delay". 121 | */ 122 | @property (nonatomic, nullable) NSString * shutterDelayText; 123 | 124 | #pragma mark - Image capture methods 125 | 126 | /** 127 | * Get an image asynchronously from the camera, library, or web. Calls the completion when an image is picked or picking is canceled. 128 | * 129 | * @param vc the view controller with which to present the image 130 | * @param interface the interface from which to get the image 131 | * @param completion a block to run with the retrieved image 132 | */ 133 | - (void) getImageInViewController:(nonnull UIViewController*)vc interface:(PXCameraInterface)interface completion:(nullable void(^)(UIImage* _Nullable, PXCameraImageSource))completion; 134 | 135 | - (nullable instancetype) init __attribute__((unavailable("use the camera singleton"))); 136 | 137 | @end 138 | -------------------------------------------------------------------------------- /Pod/Classes/PXImagePickerHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXImagePickerHelper.m 3 | // 4 | // Created by Daniel Blakemore on 9/27/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "PXImagePickerHelper.h" 28 | 29 | #import "PXCameraViewController.h" 30 | 31 | static inline UIImage* getNormalizedImage(UIImage* originalImage); 32 | 33 | @interface PXImagePickerHelper () 34 | 35 | @end 36 | 37 | @implementation PXImagePickerHelper 38 | 39 | + (PXImagePickerHelper*)sharedHelper 40 | { 41 | static PXImagePickerHelper* _sharedHelper = nil; 42 | static dispatch_once_t onceToken; 43 | 44 | dispatch_once(&onceToken, ^{ 45 | _sharedHelper = [[PXImagePickerHelper alloc] init]; 46 | }); 47 | 48 | return _sharedHelper; 49 | } 50 | 51 | + (void)getImageInViewController:(UIViewController*)vc completion:(void(^)(UIImage*, PXCameraImageSource))completion; 52 | { 53 | [[PXImagePickerHelper sharedHelper] setCompletion:completion]; 54 | 55 | [vc presentViewController:[[PXImagePickerHelper sharedHelper] imagePickerController] animated:TRUE completion:nil]; 56 | } 57 | 58 | - (id)init 59 | { 60 | self = [super init]; 61 | if (self) { 62 | _tintColor = [UIColor blackColor]; 63 | [self setImagePickerController:[[UIImagePickerController alloc] init]]; 64 | [[self imagePickerController] setDelegate:self]; 65 | } 66 | return self; 67 | } 68 | 69 | - (void(^)(UIImage*, PXCameraImageSource))completion 70 | { 71 | return _completion; 72 | } 73 | 74 | #pragma mark - 75 | #pragma mark UIImagePickerController Delegate Methods 76 | 77 | - (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info 78 | { 79 | UIImage* originalImage = [info objectForKey:@"UIImagePickerControllerOriginalImage"]; 80 | if (_completion) { 81 | _completion(getNormalizedImage(originalImage), PXCameraImageSourceLibrary); 82 | _completion = nil; 83 | } 84 | 85 | // Dismiss the picker controller 86 | [[picker presentingViewController] dismissViewControllerAnimated:TRUE completion:nil]; 87 | } 88 | 89 | - (void)imagePickerControllerDidCancel:(UIImagePickerController*)picker 90 | { 91 | if (_completion) { 92 | _completion(nil, PXCameraImageSourceLibrary); 93 | _completion = nil; 94 | } 95 | [[picker presentingViewController] dismissViewControllerAnimated:TRUE completion:nil]; 96 | } 97 | 98 | #pragma mark - Helper Methods 99 | 100 | static inline UIImage* getNormalizedImage(UIImage* originalImage) 101 | { 102 | UIImage* normalizedImage; 103 | 104 | if ([originalImage imageOrientation] == UIImageOrientationUp) 105 | { 106 | return originalImage; 107 | } 108 | 109 | CGRect rect = CGRectZero; 110 | rect.size = [originalImage size]; 111 | UIGraphicsBeginImageContext(rect.size); 112 | [originalImage drawInRect:rect]; 113 | normalizedImage = UIGraphicsGetImageFromCurrentImageContext(); 114 | UIGraphicsEndImageContext(); 115 | return normalizedImage; 116 | } 117 | 118 | #pragma mark - 119 | #pragma mark UINavigationController Delegate Methods 120 | 121 | - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 122 | { 123 | [[UIApplication sharedApplication] setStatusBarHidden:YES]; 124 | [[navigationController navigationBar] setTitleTextAttributes:@{NSForegroundColorAttributeName : _tintColor}]; 125 | [[navigationController navigationBar] setBarTintColor:_barTintColor]; 126 | [[navigationController navigationBar] setTintColor:_tintColor]; 127 | } 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /Pod/Classes/PXCamera.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXCamera.m 3 | // 4 | // Created by Daniel Blakemore on 8/21/15. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "PXCamera.h" 28 | 29 | #import "PXImagePickerHelper.h" 30 | #import "PXCameraViewController.h" 31 | 32 | #import 33 | 34 | @implementation PXCamera 35 | 36 | + (instancetype)camera 37 | { 38 | static PXCamera * _camera = nil; 39 | static dispatch_once_t onceToken; 40 | 41 | dispatch_once(&onceToken, ^{ 42 | _camera = [[PXCamera alloc] initCamera]; 43 | }); 44 | 45 | return _camera; 46 | } 47 | 48 | - (instancetype)initCamera 49 | { 50 | self = [super init]; 51 | if (self) { 52 | _shutterDelayText = @"shutter delay"; 53 | _tintColor = [UIColor blackColor]; 54 | _barTintColor = [UIColor whiteColor]; 55 | 56 | // make the photo library helper early so it's faster 57 | [PXImagePickerHelper sharedHelper]; 58 | [PXCameraViewController sharedCamera]; 59 | } 60 | return self; 61 | } 62 | 63 | - (PXCameraAuthorizationStatus)cameraAuthorized 64 | { 65 | switch ([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]) { 66 | case AVAuthorizationStatusNotDetermined: 67 | return PXCameraAuthorizationStatusNotDetermined; 68 | 69 | case AVAuthorizationStatusRestricted: 70 | return PXCameraAuthorizationStatusRestricted; 71 | 72 | case AVAuthorizationStatusAuthorized: 73 | return PXCameraAuthorizationStatusAuthorized; 74 | 75 | case AVAuthorizationStatusDenied: 76 | default: 77 | return PXCameraAuthorizationStatusDenied; 78 | } 79 | } 80 | 81 | - (PXCameraAuthorizationStatus)photosAuthorized 82 | { 83 | switch ([PHPhotoLibrary authorizationStatus]) { 84 | case PHAuthorizationStatusNotDetermined: 85 | return PXCameraAuthorizationStatusNotDetermined; 86 | 87 | case PHAuthorizationStatusRestricted: 88 | return PXCameraAuthorizationStatusRestricted; 89 | 90 | case PHAuthorizationStatusAuthorized: 91 | return PXCameraAuthorizationStatusAuthorized; 92 | 93 | case PHAuthorizationStatusDenied: 94 | default: 95 | return PXCameraAuthorizationStatusDenied; 96 | } 97 | } 98 | 99 | - (void)getImageInViewController:(UIViewController*)vc interface:(PXCameraInterface)interface completion:(void(^)(UIImage*, PXCameraImageSource))completion; 100 | { 101 | switch (interface) { 102 | case PXCameraInterfaceCamera: { 103 | [PXCameraViewController getImageInViewController:vc completion:^(UIImage * i, PXCameraImageSource s, void (^whenDone)()) { 104 | if (completion) { 105 | completion(i, s); 106 | } 107 | if (whenDone) { 108 | whenDone(); 109 | } 110 | }]; 111 | break; 112 | } 113 | 114 | case PXCameraInterfaceLibrary: 115 | default: { 116 | [[PXImagePickerHelper sharedHelper] setCompletion:completion]; 117 | [vc presentViewController:[[PXImagePickerHelper sharedHelper] imagePickerController] animated:TRUE completion:nil]; 118 | break; 119 | } 120 | } 121 | } 122 | 123 | - (void)setTintColor:(UIColor *)tintColor 124 | { 125 | _tintColor = tintColor; 126 | [[PXImagePickerHelper sharedHelper] setTintColor:_tintColor]; 127 | } 128 | 129 | - (void)setBarTintColor:(UIColor *)barTintColor 130 | { 131 | _barTintColor = barTintColor; 132 | [[PXImagePickerHelper sharedHelper] setBarTintColor:_barTintColor]; 133 | } 134 | 135 | - (void)setShutterDelayText:(NSString *)shutterDelayText 136 | { 137 | _shutterDelayText = shutterDelayText; 138 | [[PXCameraViewController sharedCamera] setShutterDelayText:_shutterDelayText]; 139 | } 140 | 141 | @end 142 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2015 Daniel Blakemore <dblakemore@pixio.com> 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | PXCamera 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2015 Daniel Blakemore <dblakemore@pixio.com> 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a copy 49 | of this software and associated documentation files (the "Software"), to deal 50 | in the Software without restriction, including without limitation the rights 51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 52 | copies of the Software, and to permit persons to whom the Software is 53 | furnished to do so, subject to the following conditions: 54 | 55 | The above copyright notice and this permission notice shall be included in 56 | all copies or substantial portions of the Software. 57 | 58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 64 | THE SOFTWARE. 65 | 66 | License 67 | MIT 68 | Title 69 | PXPinnedRotation 70 | Type 71 | PSGroupSpecifier 72 | 73 | 74 | FooterText 75 | Copyright (c) 2011-2014 Sam Vermette 76 | 77 | Permission is hereby granted, free of charge, to any person 78 | obtaining a copy of this software and associated documentation 79 | files (the "Software"), to deal in the Software without 80 | restriction, including without limitation the rights to use, 81 | copy, modify, merge, publish, distribute, sublicense, and/or sell 82 | copies of the Software, and to permit persons to whom the 83 | Software is furnished to do so, subject to the following 84 | conditions: 85 | 86 | The above copyright notice and this permission notice shall be 87 | included in all copies or substantial portions of the Software. 88 | 89 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 90 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 91 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 92 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 93 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 94 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 95 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 96 | OTHER DEALINGS IN THE SOFTWARE. 97 | 98 | A different license may apply to other resources included in this package, 99 | including Freepik Icons. Please consult their 100 | respective headers for the terms of their individual licenses. 101 | License 102 | MIT 103 | Title 104 | SVProgressHUD 105 | Type 106 | PSGroupSpecifier 107 | 108 | 109 | FooterText 110 | Generated by CocoaPods - https://cocoapods.org 111 | Title 112 | 113 | Type 114 | PSGroupSpecifier 115 | 116 | 117 | StringsTable 118 | Acknowledgements 119 | Title 120 | Acknowledgements 121 | 122 | 123 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PXCamera/Pods-PXCamera-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2015 Daniel Blakemore <dblakemore@pixio.com> 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | 37 | License 38 | MIT 39 | Title 40 | PXCamera 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2015 Daniel Blakemore <dblakemore@pixio.com> 47 | 48 | Permission is hereby granted, free of charge, to any person obtaining a copy 49 | of this software and associated documentation files (the "Software"), to deal 50 | in the Software without restriction, including without limitation the rights 51 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 52 | copies of the Software, and to permit persons to whom the Software is 53 | furnished to do so, subject to the following conditions: 54 | 55 | The above copyright notice and this permission notice shall be included in 56 | all copies or substantial portions of the Software. 57 | 58 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 59 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 60 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 61 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 62 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 63 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 64 | THE SOFTWARE. 65 | 66 | License 67 | MIT 68 | Title 69 | PXPinnedRotation 70 | Type 71 | PSGroupSpecifier 72 | 73 | 74 | FooterText 75 | Copyright (c) 2011-2014 Sam Vermette 76 | 77 | Permission is hereby granted, free of charge, to any person 78 | obtaining a copy of this software and associated documentation 79 | files (the "Software"), to deal in the Software without 80 | restriction, including without limitation the rights to use, 81 | copy, modify, merge, publish, distribute, sublicense, and/or sell 82 | copies of the Software, and to permit persons to whom the 83 | Software is furnished to do so, subject to the following 84 | conditions: 85 | 86 | The above copyright notice and this permission notice shall be 87 | included in all copies or substantial portions of the Software. 88 | 89 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 90 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 91 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 92 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 93 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 94 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 95 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 96 | OTHER DEALINGS IN THE SOFTWARE. 97 | 98 | A different license may apply to other resources included in this package, 99 | including Freepik Icons. Please consult their 100 | respective headers for the terms of their individual licenses. 101 | License 102 | MIT 103 | Title 104 | SVProgressHUD 105 | Type 106 | PSGroupSpecifier 107 | 108 | 109 | FooterText 110 | Generated by CocoaPods - https://cocoapods.org 111 | Title 112 | 113 | Type 114 | PSGroupSpecifier 115 | 116 | 117 | StringsTable 118 | Acknowledgements 119 | Title 120 | Acknowledgements 121 | 122 | 123 | -------------------------------------------------------------------------------- /Pod/Classes/PXLibraryButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXLibraryButton.m 3 | // 4 | // Created by Daniel Blakemore on 7/21/14. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "PXLibraryButton.h" 28 | #import 29 | 30 | @implementation PXLibraryButton 31 | { 32 | UIImageView * _backgroundImage; 33 | } 34 | 35 | - (id)initWithFrame:(CGRect)frame 36 | { 37 | self = [super initWithFrame:frame]; 38 | if (self) { 39 | // Initialization code 40 | [self setClipsToBounds:TRUE]; 41 | 42 | _backgroundImage = [[UIImageView alloc] init]; 43 | [_backgroundImage setContentMode:UIViewContentModeScaleAspectFill]; 44 | [_backgroundImage setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 45 | [self addSubview:_backgroundImage]; 46 | 47 | NSDictionary* views = NSDictionaryOfVariableBindings(_backgroundImage); 48 | NSDictionary* metrics = @{}; 49 | 50 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_backgroundImage]|" options:0 metrics:metrics views:views]]; 51 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_backgroundImage]|" options:0 metrics:metrics views:views]]; 52 | 53 | [[NSNotificationCenter defaultCenter] addObserver:self 54 | selector:@selector(loadNewestPhoto) 55 | name:ALAssetsLibraryChangedNotification 56 | object:nil]; 57 | 58 | [self loadNewestPhoto]; 59 | 60 | } 61 | return self; 62 | } 63 | 64 | - (void)dealloc 65 | { 66 | // unobserve(d catheters) 67 | [[NSNotificationCenter defaultCenter] removeObserver:self 68 | name:ALAssetsLibraryChangedNotification 69 | object:nil]; 70 | } 71 | 72 | #pragma mark - photo methods 73 | 74 | - (void)loadNewestPhoto 75 | { 76 | // http://stackoverflow.com/a/10200857/579405 77 | ALAssetsLibrary *assetsLibrary = [[ALAssetsLibrary alloc] init]; 78 | [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupSavedPhotos 79 | usingBlock:^(ALAssetsGroup *group, BOOL *stop) { 80 | if (nil != group) { 81 | // be sure to filter the group so you only get photos 82 | [group setAssetsFilter:[ALAssetsFilter allPhotos]]; 83 | 84 | [group enumerateAssetsWithOptions:NSEnumerationReverse usingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) { 85 | if (nil != result) { 86 | ALAssetRepresentation *repr = [result defaultRepresentation]; 87 | // this is the most recent saved photo 88 | [self setNewPhoto:[UIImage imageWithCGImage:[repr fullScreenImage]]]; 89 | // we only need the first (most recent) photo -- stop the enumeration 90 | *stop = YES; 91 | } 92 | }]; 93 | } 94 | 95 | *stop = NO; 96 | } failureBlock:^(NSError *error) { 97 | NSLog(@"error: %@", error); 98 | }]; 99 | } 100 | 101 | - (void)setNewPhoto:(UIImage*)photo 102 | { 103 | [_backgroundImage setImage:photo]; 104 | } 105 | 106 | #pragma mark - Touches 107 | 108 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 109 | { 110 | // cool story bro 111 | } 112 | 113 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 114 | { 115 | // brool story co 116 | } 117 | 118 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 119 | { 120 | // touch time 121 | [self sendActionsForControlEvents:UIControlEventTouchUpInside]; 122 | } 123 | 124 | - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 125 | { 126 | // stool cory bro 127 | } 128 | 129 | @end 130 | -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/SVProgressHUD/SVIndefiniteAnimatedView.m: -------------------------------------------------------------------------------- 1 | // 2 | // SVIndefiniteAnimatedView.m 3 | // SVProgressHUD 4 | // 5 | // Created by Guillaume Campagna on 2014-12-05. 6 | // 7 | // 8 | 9 | #import "SVIndefiniteAnimatedView.h" 10 | 11 | #pragma mark SVIndefiniteAnimatedView 12 | 13 | @interface SVIndefiniteAnimatedView () 14 | 15 | @property (nonatomic, strong) CAShapeLayer *indefiniteAnimatedLayer; 16 | 17 | @end 18 | 19 | @implementation SVIndefiniteAnimatedView 20 | 21 | - (void)willMoveToSuperview:(UIView *)newSuperview { 22 | if (newSuperview) { 23 | [self layoutAnimatedLayer]; 24 | } else { 25 | [_indefiniteAnimatedLayer removeFromSuperlayer]; 26 | _indefiniteAnimatedLayer = nil; 27 | } 28 | } 29 | 30 | - (void)layoutAnimatedLayer { 31 | CALayer *layer = self.indefiniteAnimatedLayer; 32 | 33 | [self.layer addSublayer:layer]; 34 | layer.position = CGPointMake(CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds) / 2, CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds) / 2); 35 | } 36 | 37 | - (CAShapeLayer*)indefiniteAnimatedLayer { 38 | if(!_indefiniteAnimatedLayer) { 39 | CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5); 40 | CGRect rect = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2); 41 | 42 | UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter 43 | radius:self.radius 44 | startAngle:M_PI*3/2 45 | endAngle:M_PI/2+M_PI*5 46 | clockwise:YES]; 47 | 48 | _indefiniteAnimatedLayer = [CAShapeLayer layer]; 49 | _indefiniteAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale]; 50 | _indefiniteAnimatedLayer.frame = rect; 51 | _indefiniteAnimatedLayer.fillColor = [UIColor clearColor].CGColor; 52 | _indefiniteAnimatedLayer.strokeColor = self.strokeColor.CGColor; 53 | _indefiniteAnimatedLayer.lineWidth = self.strokeThickness; 54 | _indefiniteAnimatedLayer.lineCap = kCALineCapRound; 55 | _indefiniteAnimatedLayer.lineJoin = kCALineJoinBevel; 56 | _indefiniteAnimatedLayer.path = smoothedPath.CGPath; 57 | 58 | CALayer *maskLayer = [CALayer layer]; 59 | 60 | NSBundle *bundle = [NSBundle bundleForClass:self.class]; 61 | NSURL *url = [bundle URLForResource:@"SVProgressHUD" withExtension:@"bundle"]; 62 | NSBundle *imageBundle = [NSBundle bundleWithURL:url]; 63 | NSString *path = [imageBundle pathForResource:@"angle-mask" ofType:@"png"]; 64 | 65 | maskLayer.contents = (id)[[UIImage imageWithContentsOfFile:path] CGImage];; 66 | maskLayer.frame = _indefiniteAnimatedLayer.bounds; 67 | _indefiniteAnimatedLayer.mask = maskLayer; 68 | 69 | NSTimeInterval animationDuration = 1; 70 | CAMediaTimingFunction *linearCurve = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 71 | 72 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; 73 | animation.fromValue = 0; 74 | animation.toValue = [NSNumber numberWithFloat:M_PI*2]; 75 | animation.duration = animationDuration; 76 | animation.timingFunction = linearCurve; 77 | animation.removedOnCompletion = NO; 78 | animation.repeatCount = INFINITY; 79 | animation.fillMode = kCAFillModeForwards; 80 | animation.autoreverses = NO; 81 | [_indefiniteAnimatedLayer.mask addAnimation:animation forKey:@"rotate"]; 82 | 83 | CAAnimationGroup *animationGroup = [CAAnimationGroup animation]; 84 | animationGroup.duration = animationDuration; 85 | animationGroup.repeatCount = INFINITY; 86 | animationGroup.removedOnCompletion = NO; 87 | animationGroup.timingFunction = linearCurve; 88 | 89 | CABasicAnimation *strokeStartAnimation = [CABasicAnimation animationWithKeyPath:@"strokeStart"]; 90 | strokeStartAnimation.fromValue = @0.015; 91 | strokeStartAnimation.toValue = @0.515; 92 | 93 | CABasicAnimation *strokeEndAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"]; 94 | strokeEndAnimation.fromValue = @0.485; 95 | strokeEndAnimation.toValue = @0.985; 96 | 97 | animationGroup.animations = @[strokeStartAnimation, strokeEndAnimation]; 98 | [_indefiniteAnimatedLayer addAnimation:animationGroup forKey:@"progress"]; 99 | 100 | } 101 | return _indefiniteAnimatedLayer; 102 | } 103 | 104 | - (void)setFrame:(CGRect)frame { 105 | [super setFrame:frame]; 106 | 107 | if (self.superview) { 108 | [self layoutAnimatedLayer]; 109 | } 110 | } 111 | 112 | - (void)setRadius:(CGFloat)radius { 113 | _radius = radius; 114 | 115 | [_indefiniteAnimatedLayer removeFromSuperlayer]; 116 | _indefiniteAnimatedLayer = nil; 117 | 118 | if (self.superview) { 119 | [self layoutAnimatedLayer]; 120 | } 121 | } 122 | 123 | - (void)setStrokeColor:(UIColor *)strokeColor { 124 | _strokeColor = strokeColor; 125 | _indefiniteAnimatedLayer.strokeColor = strokeColor.CGColor; 126 | } 127 | 128 | - (void)setStrokeThickness:(CGFloat)strokeThickness { 129 | _strokeThickness = strokeThickness; 130 | _indefiniteAnimatedLayer.lineWidth = _strokeThickness; 131 | } 132 | 133 | - (CGSize)sizeThatFits:(CGSize)size { 134 | return CGSizeMake((self.radius+self.strokeThickness/2+5)*2, (self.radius+self.strokeThickness/2+5)*2); 135 | } 136 | 137 | @end 138 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-Tests/Pods-Tests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | *) 25 | TARGET_DEVICE_ARGS="--target-device mac" 26 | ;; 27 | esac 28 | 29 | install_resource() 30 | { 31 | if [[ "$1" = /* ]] ; then 32 | RESOURCE_PATH="$1" 33 | else 34 | RESOURCE_PATH="${PODS_ROOT}/$1" 35 | fi 36 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 37 | cat << EOM 38 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 39 | EOM 40 | exit 1 41 | fi 42 | case $RESOURCE_PATH in 43 | *.storyboard) 44 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 45 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 46 | ;; 47 | *.xib) 48 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 49 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 50 | ;; 51 | *.framework) 52 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 54 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 55 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | ;; 57 | *.xcdatamodel) 58 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 59 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 60 | ;; 61 | *.xcdatamodeld) 62 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 63 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 64 | ;; 65 | *.xcmappingmodel) 66 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 67 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 68 | ;; 69 | *.xcassets) 70 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 71 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 72 | ;; 73 | *) 74 | echo "$RESOURCE_PATH" 75 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 76 | ;; 77 | esac 78 | } 79 | if [[ "$CONFIGURATION" == "Debug" ]]; then 80 | install_resource "$PODS_CONFIGURATION_BUILD_DIR/PXCamera/PXCamera.bundle" 81 | install_resource "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation/PXPinnedRotation.bundle" 82 | install_resource "SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle" 83 | fi 84 | if [[ "$CONFIGURATION" == "Release" ]]; then 85 | install_resource "$PODS_CONFIGURATION_BUILD_DIR/PXCamera/PXCamera.bundle" 86 | install_resource "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation/PXPinnedRotation.bundle" 87 | install_resource "SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle" 88 | fi 89 | 90 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 91 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 92 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 93 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 94 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | rm -f "$RESOURCES_TO_COPY" 97 | 98 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 99 | then 100 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 101 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 102 | while read line; do 103 | if [[ $line != "${PODS_ROOT}*" ]]; then 104 | XCASSET_FILES+=("$line") 105 | fi 106 | done <<<"$OTHER_XCASSETS" 107 | 108 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 109 | fi 110 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-PXCamera/Pods-PXCamera-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | case "${TARGETED_DEVICE_FAMILY}" in 12 | 1,2) 13 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 14 | ;; 15 | 1) 16 | TARGET_DEVICE_ARGS="--target-device iphone" 17 | ;; 18 | 2) 19 | TARGET_DEVICE_ARGS="--target-device ipad" 20 | ;; 21 | 3) 22 | TARGET_DEVICE_ARGS="--target-device tv" 23 | ;; 24 | *) 25 | TARGET_DEVICE_ARGS="--target-device mac" 26 | ;; 27 | esac 28 | 29 | install_resource() 30 | { 31 | if [[ "$1" = /* ]] ; then 32 | RESOURCE_PATH="$1" 33 | else 34 | RESOURCE_PATH="${PODS_ROOT}/$1" 35 | fi 36 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 37 | cat << EOM 38 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 39 | EOM 40 | exit 1 41 | fi 42 | case $RESOURCE_PATH in 43 | *.storyboard) 44 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 45 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 46 | ;; 47 | *.xib) 48 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" 49 | ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} 50 | ;; 51 | *.framework) 52 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 53 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 54 | echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 55 | rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 56 | ;; 57 | *.xcdatamodel) 58 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" 59 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 60 | ;; 61 | *.xcdatamodeld) 62 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" 63 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 64 | ;; 65 | *.xcmappingmodel) 66 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" 67 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 68 | ;; 69 | *.xcassets) 70 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 71 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 72 | ;; 73 | *) 74 | echo "$RESOURCE_PATH" 75 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 76 | ;; 77 | esac 78 | } 79 | if [[ "$CONFIGURATION" == "Debug" ]]; then 80 | install_resource "$PODS_CONFIGURATION_BUILD_DIR/PXCamera/PXCamera.bundle" 81 | install_resource "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation/PXPinnedRotation.bundle" 82 | install_resource "SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle" 83 | fi 84 | if [[ "$CONFIGURATION" == "Release" ]]; then 85 | install_resource "$PODS_CONFIGURATION_BUILD_DIR/PXCamera/PXCamera.bundle" 86 | install_resource "$PODS_CONFIGURATION_BUILD_DIR/PXPinnedRotation/PXPinnedRotation.bundle" 87 | install_resource "SVProgressHUD/SVProgressHUD/SVProgressHUD.bundle" 88 | fi 89 | 90 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 91 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 92 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 93 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 94 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 95 | fi 96 | rm -f "$RESOURCES_TO_COPY" 97 | 98 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 99 | then 100 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 101 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 102 | while read line; do 103 | if [[ $line != "${PODS_ROOT}*" ]]; then 104 | XCASSET_FILES+=("$line") 105 | fi 106 | done <<<"$OTHER_XCASSETS" 107 | 108 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 109 | fi 110 | -------------------------------------------------------------------------------- /Example/Pods/SVProgressHUD/README.md: -------------------------------------------------------------------------------- 1 | # SVProgressHUD 2 | 3 | `SVProgressHUD` is a clean and easy-to-use HUD meant to display the progress of an ongoing task. 4 | 5 | ![SVProgressHUD](http://f.cl.ly/items/2G1F1Z0M0k0h2U3V1p39/SVProgressHUD.gif) 6 | 7 | ## Installation 8 | 9 | ### From CocoaPods 10 | 11 | [CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like `SVProgressHUD` in your projects. Simply add the following line to your [Podfile](http://guides.cocoapods.org/using/using-cocoapods.html): 12 | 13 | ```ruby 14 | pod 'SVProgressHUD' 15 | ``` 16 | 17 | If you want to use the latest features of `SVProgressHUD` add `:head`: 18 | 19 | ```ruby 20 | pod 'SVProgressHUD', :head 21 | ``` 22 | 23 | This pulls from the `master` branch directly. We are usually careful about what we push there and this is the version we use ourselves in all of our projects. 24 | 25 | ### Carthage 26 | 27 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/TransitApp/SVProgressHUD) 28 | 29 | You can install SVProgressHUD with Carthage 30 | 31 | ### Manually 32 | 33 | * Drag the `SVProgressHUD/SVProgressHUD` folder into your project. 34 | * Take care that `SVProgressHUD.bundle` is added to `Targets->Build Phases->Copy Bundle Resources`. 35 | * Add the **QuartzCore** framework to your project. 36 | 37 | ## Usage 38 | 39 | (see sample Xcode project in `/Demo`) 40 | 41 | `SVProgressHUD` is created as a singleton (i.e. it doesn't need to be explicitly allocated and instantiated; you directly call `[SVProgressHUD method]`). 42 | 43 | **Use `SVProgressHUD` wisely! Only use it if you absolutely need to perform a task before taking the user forward. Bad use case examples: pull to refresh, infinite scrolling, sending message.** 44 | 45 | Using `SVProgressHUD` in your app will usually look as simple as this (using Grand Central Dispatch): 46 | 47 | ```objective-c 48 | [SVProgressHUD show]; 49 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 50 | // time-consuming task 51 | dispatch_async(dispatch_get_main_queue(), ^{ 52 | [SVProgressHUD dismiss]; 53 | }); 54 | }); 55 | ``` 56 | 57 | ### Showing the HUD 58 | 59 | You can show the status of indeterminate tasks using one of the following: 60 | 61 | ```objective-c 62 | + (void)show; 63 | + (void)showWithMaskType:(SVProgressHUDMaskType)maskType; 64 | + (void)showWithStatus:(NSString*)string; 65 | + (void)showWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType; 66 | ``` 67 | 68 | If you'd like the HUD to reflect the progress of a task, use one of these: 69 | 70 | ```objective-c 71 | + (void)showProgress:(CGFloat)progress; 72 | + (void)showProgress:(CGFloat)progress status:(NSString*)status; 73 | + (void)showProgress:(CGFloat)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 74 | ``` 75 | 76 | ### Dismissing the HUD 77 | 78 | It can be dismissed right away using: 79 | 80 | ```objective-c 81 | + (void)dismiss; 82 | ``` 83 | 84 | If you'd like to stack HUDs, you can balance out every show call using: 85 | 86 | ```objective-c 87 | + (void)popActivity; 88 | ``` 89 | 90 | The HUD will get dismissed once the `popActivity` calls will match the number of show calls. 91 | 92 | Or show a confirmation glyph before before getting dismissed a little bit later. The display time depends on the length of the given string (between 0.5 and 5 seconds). 93 | 94 | ```objective-c 95 | + (void)showInfoWithStatus:(NSString *)string; 96 | + (void)showInfoWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType; 97 | + (void)showSuccessWithStatus:(NSString*)string; 98 | + (void)showSuccessWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)maskType; 99 | + (void)showErrorWithStatus:(NSString *)string; 100 | + (void)showErrorWithStatus:(NSString *)string maskType:(SVProgressHUDMaskType)maskType; 101 | + (void)showImage:(UIImage*)image status:(NSString*)string; 102 | + (void)showImage:(UIImage*)image status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 103 | ``` 104 | 105 | ## Customization 106 | 107 | `SVProgressHUD` can be customized via the following methods: 108 | 109 | ```objective-c 110 | + (void)setBackgroundColor:(UIColor*)color; // default is [UIColor whiteColor] 111 | + (void)setForegroundColor:(UIColor*)color; // default is [UIColor blackColor] 112 | + (void)setRingThickness:(CGFloat)width; // default is 4 pt 113 | + (void)setFont:(UIFont*)font; // default is [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline] 114 | + (void)setInfoImage:(UIImage*)image; // default is the bundled info image provided by Freepik 115 | + (void)setSuccessImage:(UIImage*)image; // default is bundled success image from Freepik 116 | + (void)setErrorImage:(UIImage*)image; // default is bundled error image from Freepik 117 | + (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType; // default is SVProgressHUDMaskTypeNone 118 | + (void)setViewForExtension:(UIView*)view; // default is nil, only used if #define SV_APP_EXTENSIONS is set 119 | ``` 120 | 121 | ## Notifications 122 | 123 | `SVProgressHUD` posts four notifications via `NSNotificationCenter` in response to being shown/dismissed: 124 | * `SVProgressHUDWillAppearNotification` when the show animation starts 125 | * `SVProgressHUDDidAppearNotification` when the show animation completes 126 | * `SVProgressHUDWillDisappearNotification` when the dismiss animation starts 127 | * `SVProgressHUDDidDisappearNotification` when the dismiss animation completes 128 | 129 | Each notification passes a `userInfo` dictionary holding the HUD's status string (if any), retrievable via `SVProgressHUDStatusUserInfoKey`. 130 | 131 | `SVProgressHUD` also posts `SVProgressHUDDidReceiveTouchEventNotification` when users touch on the overall screen or `SVProgressHUDDidTouchDownInsideNotification` when a user touches on the HUD directly. For this notifications `userInfo` is not passed but the object parameter contains the `UIEvent` that related to the touch. 132 | 133 | ## App Extensions 134 | 135 | When using `SVProgressHUD` in an App Extension, #define SV_APP_EXTENSIONS to avoid using unavailable APIs. Additionally call `setViewForExtension:` from your extensions view controller with `self.view`. 136 | 137 | ## Contributing to this project 138 | 139 | If you have feature requests or bug reports, feel free to help out by sending pull requests or by [creating new issues](https://github.com/samvermette/SVProgressHUD/issues/new). Please take a moment to 140 | review the guidelines written by [Nicolas Gallagher](https://github.com/necolas/): 141 | 142 | * [Bug reports](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#bugs) 143 | * [Feature requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#features) 144 | * [Pull requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#pull-requests) 145 | 146 | ## Credits 147 | 148 | `SVProgressHUD` is brought to you by [Sam Vermette](http://samvermette.com) and [contributors to the project](https://github.com/samvermette/SVProgressHUD/contributors). If you're using `SVProgressHUD` in your project, attribution would be very appreciated. The info, success and error icons are made by [Freepik](http://www.freepik.com) from [Flaticon](www.flaticon.com) and are licensed under [Creative Commons BY 3.0](http://creativecommons.org/licenses/by/3.0/). 149 | -------------------------------------------------------------------------------- /Example/PXCamera/PXExampleViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXViewController.m 3 | // PXCamera 4 | // 5 | // Created by Daniel Blakemore on 05/01/2015. 6 | // Copyright (c) 2014 Daniel Blakemore. All rights reserved. 7 | // 8 | 9 | #import "PXExampleViewController.h" 10 | 11 | #import 12 | #import 13 | 14 | #import "PXCustomCameraViewController.h" 15 | 16 | @interface PXExampleViewController () 17 | 18 | @end 19 | 20 | @implementation PXExampleViewController 21 | { 22 | UIButton * _cameraButton; 23 | UIButton * _cameraButton2; 24 | UIButton * _libraryButton; 25 | UIButton * _customCameraButton; 26 | } 27 | 28 | - (void)viewDidLoad 29 | { 30 | [super viewDidLoad]; 31 | // Do any additional setup after loading the view, typically from a nib. 32 | [self setTitle:@"PXCamera"]; 33 | 34 | // make some buttons 35 | _cameraButton = [UIButton buttonWithType:UIButtonTypeCustom]; 36 | [_cameraButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 37 | [_cameraButton setTitle:@"Present Camera" forState:UIControlStateNormal]; 38 | [_cameraButton setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 39 | [[self view] addSubview:_cameraButton]; 40 | [_cameraButton addTarget:self action:@selector(cameraPressed) forControlEvents:UIControlEventTouchUpInside]; 41 | 42 | _cameraButton2 = [UIButton buttonWithType:UIButtonTypeCustom]; 43 | [_cameraButton2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 44 | [_cameraButton2 setTitle:@"Navigate to Camera" forState:UIControlStateNormal]; 45 | [_cameraButton2 setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 46 | [[self view] addSubview:_cameraButton2]; 47 | [_cameraButton2 addTarget:self action:@selector(cameraPressed2) forControlEvents:UIControlEventTouchUpInside]; 48 | 49 | _libraryButton = [UIButton buttonWithType:UIButtonTypeCustom]; 50 | [_libraryButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 51 | [_libraryButton setTitle:@"Present Library" forState:UIControlStateNormal]; 52 | [_libraryButton setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 53 | [[self view] addSubview:_libraryButton]; 54 | [_libraryButton addTarget:self action:@selector(libraryPressed) forControlEvents:UIControlEventTouchUpInside]; 55 | 56 | _customCameraButton = [UIButton buttonWithType:UIButtonTypeCustom]; 57 | [_customCameraButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 58 | [_customCameraButton setTitle:@"Navigate to Custom Camera" forState:UIControlStateNormal]; 59 | [_customCameraButton setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 60 | [[self view] addSubview:_customCameraButton]; 61 | [_customCameraButton addTarget:self action:@selector(customCameraPressed) forControlEvents:UIControlEventTouchUpInside]; 62 | 63 | NSDictionary * views = NSDictionaryOfVariableBindings(_cameraButton, _cameraButton2, _libraryButton, _customCameraButton); 64 | NSDictionary * metrics = @{@"bw" : @(250), @"bh" : @(50), @"sp" : @(10)}; 65 | 66 | [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_cameraButton(bw)]" options:0 metrics:metrics views:views]]; 67 | [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_cameraButton2(bw)]" options:0 metrics:metrics views:views]]; 68 | [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_libraryButton(bw)]" options:0 metrics:metrics views:views]]; 69 | [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_customCameraButton(bw)]" options:0 metrics:metrics views:views]]; 70 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:_cameraButton attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]]; 71 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:_cameraButton2 attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]]; 72 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:_libraryButton attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]]; 73 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:_customCameraButton attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]]; 74 | 75 | [[self view] addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_cameraButton(bh)]-sp-[_cameraButton2(bh)]-sp-[_libraryButton(bh)]-sp-[_customCameraButton(bh)]" options:0 metrics:metrics views:views]]; 76 | [[self view] addConstraint:[NSLayoutConstraint constraintWithItem:_libraryButton attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:[self view] attribute:NSLayoutAttributeCenterY multiplier:1.0f constant:0.0f]]; 77 | } 78 | 79 | - (BOOL)checkCameraAuthorization 80 | { 81 | return ([[PXCamera camera] cameraAuthorized] == PXCameraAuthorizationStatusAuthorized || 82 | [[PXCamera camera] cameraAuthorized] == PXCameraAuthorizationStatusNotDetermined); 83 | } 84 | 85 | - (void)cameraPressed 86 | { 87 | if ([self checkCameraAuthorization]) { 88 | [[PXCamera camera] getImageInViewController:self interface:PXCameraInterfaceCamera completion:^(UIImage * image, PXCameraImageSource source) { 89 | NSLog(@"C: %@", image); 90 | }]; 91 | } else { 92 | NSLog(@"no permission, no camera"); 93 | } 94 | } 95 | 96 | - (void)cameraPressed2 97 | { 98 | PXCameraViewController * cvc = [PXCameraViewController sharedCamera]; 99 | [cvc setCompletion:^(UIImage * image, PXCameraImageSource source, void (^whenDone)()) { 100 | if (source != PXCameraImageSourceNone) { 101 | // demonstrate post-camera view controller transition 102 | UIViewController * postCameraVC = [[UIViewController alloc] init]; 103 | [postCameraVC setTitle:@"Post-Camera Screen"]; 104 | [[postCameraVC view] setBackgroundColor:[UIColor grayColor]]; 105 | [[self navigationController] pushViewController:postCameraVC animated:TRUE]; 106 | 107 | // reset navigation stack without the camera in it (just because) 108 | NSMutableArray * newViewControllers = [NSMutableArray array]; 109 | [[[self navigationController] viewControllers] enumerateObjectsUsingBlock:^(UIViewController * obj, NSUInteger idx, BOOL *stop) { 110 | if (![obj isKindOfClass:[PXCameraViewController class]]) { 111 | [newViewControllers addObject:obj]; 112 | } 113 | }]; 114 | [[self navigationController] setViewControllers:newViewControllers]; 115 | } else { 116 | [[self navigationController] popViewControllerAnimated:TRUE]; 117 | } 118 | 119 | if (whenDone) { 120 | whenDone(); 121 | } 122 | NSLog(@"C: %@", image); 123 | }]; 124 | [[self navigationController] pushViewController:cvc animated:TRUE]; 125 | } 126 | 127 | - (void)libraryPressed 128 | { 129 | [[PXCamera camera] getImageInViewController:self interface:PXCameraInterfaceLibrary completion:^(UIImage * image, PXCameraImageSource source) { 130 | NSLog(@"L: %@", image); 131 | }]; 132 | } 133 | 134 | - (void)customCameraPressed 135 | { 136 | [[self navigationController] pushViewController:[[PXCustomCameraViewController alloc] init] animated:TRUE]; 137 | } 138 | 139 | - (void)didReceiveMemoryWarning 140 | { 141 | [super didReceiveMemoryWarning]; 142 | // Dispose of any resources that can be recreated. 143 | } 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /Example/Pods/PXPinnedRotation/Pod/Classes/PXPinnedRotationViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXPinnedRotationViewController 3 | // 4 | // Created by acobb on 5/16/14. 5 | // Updated and finished by Daniel Blakemore ca. 9/26/14. 6 | // 7 | // Copyright (c) 2015 Pixio 8 | // 9 | // Permission is hereby granted, free of charge, to any person obtaining a copy 10 | // of this software and associated documentation files (the "Software"), to deal 11 | // in the Software without restriction, including without limitation the rights 12 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | // copies of the Software, and to permit persons to whom the Software is 14 | // furnished to do so, subject to the following conditions: 15 | // 16 | // The above copyright notice and this permission notice shall be included in 17 | // all copies or substantial portions of the Software. 18 | // 19 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | // THE SOFTWARE. 26 | // 27 | 28 | #import "PXPinnedRotationViewController.h" 29 | #import "PXPinnedRotationView.h" 30 | 31 | #define SYSTEM_VERSION_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedSame) 32 | #define SYSTEM_VERSION_GREATER_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedDescending) 33 | #define SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending) 34 | #define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) 35 | #define SYSTEM_VERSION_LESS_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedDescending) 36 | 37 | @implementation PXPinnedRotationViewController 38 | { 39 | BOOL _hideStatusBar; 40 | } 41 | 42 | - (PXPinnedRotationView*)rotationView 43 | { 44 | return (PXPinnedRotationView*)[self view]; 45 | } 46 | 47 | - (void)setView:(UIView *)view 48 | { 49 | NSAssert(view == nil || [view isKindOfClass:[PXPinnedRotationView class]], @"View controller view must be a subclass of PXPinnedRotationView"); 50 | [super setView:view]; 51 | } 52 | 53 | - (void)viewDidLoad 54 | { 55 | [super viewDidLoad]; 56 | 57 | // do an initial layout pass to make sure we are laid out to the correct orientation 58 | [[self rotationView] setOrientation:[[UIApplication sharedApplication] statusBarOrientation]]; 59 | if (_onRotationBlock) { 60 | _onRotationBlock([[UIApplication sharedApplication] statusBarOrientation]); 61 | } 62 | if (_postRotationBlock) { 63 | _postRotationBlock([[UIApplication sharedApplication] statusBarOrientation]); 64 | } 65 | } 66 | 67 | - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 68 | { 69 | // check if this method is deprecated on this system or not. 70 | if (SYSTEM_VERSION_LESS_THAN(@"8.0")) { 71 | // do something 72 | [UIView setAnimationsEnabled:NO]; 73 | self.rotationView.orientation = toInterfaceOrientation; 74 | 75 | int halfPis[5]; 76 | halfPis[UIInterfaceOrientationPortrait] = 0; 77 | halfPis[UIInterfaceOrientationLandscapeLeft] = 1; 78 | halfPis[UIInterfaceOrientationPortraitUpsideDown] = 2; 79 | halfPis[UIInterfaceOrientationLandscapeRight] = 3; 80 | 81 | int rots = (4 + (halfPis[toInterfaceOrientation] - halfPis[self.interfaceOrientation])) % 4; 82 | 83 | for (UIView* v in self.rotationView.viewsToAnimateRotation) 84 | { 85 | v.transform = CGAffineTransformMakeRotation(rots * M_PI_2); 86 | } 87 | 88 | _hideStatusBar = TRUE; 89 | [self setNeedsStatusBarAppearanceUpdate]; 90 | } 91 | } 92 | 93 | - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 94 | { 95 | // check if this method is deprecated on this system or not. 96 | if (SYSTEM_VERSION_LESS_THAN(@"8.0")) { 97 | // do something 98 | if (_onRotationBlock) { 99 | _onRotationBlock([[UIApplication sharedApplication] statusBarOrientation]); 100 | } 101 | 102 | [self.view.layer removeAnimationForKey:@"transform"]; 103 | [self.view.layer removeAnimationForKey:@"bounds"]; 104 | [self.view.layer removeAnimationForKey:@"position"]; 105 | for (UIView* v in self.rotationView.viewsToAnimateRotation) 106 | { 107 | [v.layer removeAnimationForKey:@"bounds"]; 108 | [v.layer removeAnimationForKey:@"position"]; 109 | } 110 | 111 | // not sure why this block is needed, but it is... 112 | [UIView setAnimationsEnabled:YES]; 113 | 114 | [UIView animateWithDuration:0 animations:^ { 115 | for (UIView* v in self.rotationView.viewsToAnimateRotation) 116 | { 117 | v.transform = CGAffineTransformIdentity; 118 | } 119 | }]; 120 | } 121 | } 122 | 123 | - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation 124 | { 125 | // check if this method is deprecated on this system or not. 126 | if (SYSTEM_VERSION_LESS_THAN(@"8.0")) { 127 | // do something 128 | [UIView animateWithDuration:0.1 animations:^{ 129 | _hideStatusBar = FALSE; 130 | [self setNeedsStatusBarAppearanceUpdate]; 131 | }]; 132 | } 133 | } 134 | 135 | - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator 136 | { 137 | // hide the status bar during rotation. 138 | _hideStatusBar = TRUE; 139 | [self setNeedsStatusBarAppearanceUpdate]; 140 | 141 | // capture the old orientation 142 | UIInterfaceOrientation previousOrientation = self.interfaceOrientation; 143 | 144 | [UIView setAnimationsEnabled:NO]; 145 | 146 | // NSLog(@"disabling animation"); 147 | [coordinator animateAlongsideTransition:^(id context) { 148 | 149 | // NSLog(@"on rotation"); 150 | if (_onRotationBlock) { 151 | _onRotationBlock([[UIApplication sharedApplication] statusBarOrientation]); 152 | } 153 | 154 | // rotate views to what would have been the current orientation if rotation was not enabled 155 | // so that then they can be rotated into the correct orientation as if all they have done is rotate (rather than teleport) 156 | int halfPis[5]; 157 | halfPis[UIInterfaceOrientationPortrait] = 0; 158 | halfPis[UIInterfaceOrientationLandscapeLeft] = 1; 159 | halfPis[UIInterfaceOrientationPortraitUpsideDown] = 2; 160 | halfPis[UIInterfaceOrientationLandscapeRight] = 3; 161 | 162 | int rots = (4 + (halfPis[[[UIApplication sharedApplication] statusBarOrientation]] - halfPis[previousOrientation])) % 4; 163 | 164 | for (UIView* v in self.rotationView.viewsToAnimateRotation) 165 | { 166 | v.transform = CGAffineTransformMakeRotation(rots * M_PI_2); 167 | } 168 | 169 | // change constraints to match new screen. 170 | // NSLog(@"new constraints"); 171 | self.rotationView.orientation = [[UIApplication sharedApplication] statusBarOrientation]; 172 | 173 | } completion:^(id context) { 174 | // NSLog(@"enabling animations"); 175 | // enable animations only after rotation is entirely done 176 | [UIView setAnimationsEnabled:YES]; 177 | 178 | // rotate views back into place once rotation has finished. This is actually the only animation that the user sees. 179 | [UIView animateWithDuration:0.2 animations:^{ 180 | // NSLog(@"post rotation"); 181 | if (_postRotationBlock) { 182 | _postRotationBlock([[UIApplication sharedApplication] statusBarOrientation]); 183 | } 184 | 185 | for (UIView* v in self.rotationView.viewsToAnimateRotation) 186 | { 187 | v.transform = CGAffineTransformIdentity; 188 | } 189 | // show status bar as well. 190 | _hideStatusBar = FALSE; 191 | [self setNeedsStatusBarAppearanceUpdate]; 192 | } completion:^(BOOL finished) { 193 | // NSLog(@"Done"); 194 | [UIView setAnimationsEnabled:YES]; 195 | }]; 196 | }]; 197 | } 198 | 199 | - (NSUInteger)supportedInterfaceOrientations 200 | { 201 | return UIInterfaceOrientationMaskAll; 202 | } 203 | 204 | - (BOOL)prefersStatusBarHidden 205 | { 206 | return _hideStatusBar; 207 | } 208 | 209 | - (UIStatusBarAnimation)preferredStatusBarUpdateAnimation 210 | { 211 | return UIStatusBarAnimationFade; 212 | } 213 | 214 | @end 215 | -------------------------------------------------------------------------------- /Pod/Classes/PXFlashControl.m: -------------------------------------------------------------------------------- 1 | // 2 | // PXFlashButton.m 3 | // 4 | // Created by Daniel Blakemore on 10/11/13. 5 | // 6 | // Copyright (c) 2015 Pixio 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | // 26 | 27 | #import "PXFlashControl.h" 28 | 29 | @implementation PXFlashControl 30 | { 31 | UIImageView * _autoView; 32 | UIImageView * _onView; 33 | UIImageView * _offView; 34 | UIImageView * _unavailableView; 35 | PXFlashType _value; 36 | 37 | BOOL _expanded; 38 | BOOL _receivingTouches; 39 | 40 | PXFlashControlOrientation _orientation; 41 | } 42 | 43 | - (id)initWithFrame:(CGRect)frame 44 | { 45 | self = [super initWithFrame:frame]; 46 | if (self) { 47 | // Initialization code 48 | _receivingTouches = TRUE; 49 | 50 | [self setMultipleTouchEnabled:FALSE]; 51 | 52 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 53 | NSURL *url = [bundle URLForResource:@"PXCamera" withExtension:@"bundle"]; 54 | NSBundle *imageBundle = [NSBundle bundleWithURL:url]; 55 | 56 | _autoView = [[UIImageView alloc] init]; 57 | [_autoView setContentMode:UIViewContentModeCenter]; 58 | [_autoView setBackgroundColor:[UIColor clearColor]]; 59 | [_autoView setImage:[UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"flash-auto" ofType:@"png"]]]; 60 | [_autoView setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 61 | [self addSubview:_autoView]; 62 | 63 | _onView = [[UIImageView alloc] init]; 64 | [_onView setContentMode:UIViewContentModeCenter]; 65 | [_onView setBackgroundColor:[UIColor clearColor]]; 66 | [_onView setImage:[UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"flash-on" ofType:@"png"]]]; 67 | [_onView setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 68 | [self addSubview:_onView]; 69 | 70 | _offView = [[UIImageView alloc] init]; 71 | [_offView setContentMode:UIViewContentModeCenter]; 72 | [_offView setBackgroundColor:[UIColor clearColor]]; 73 | [_offView setImage:[UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"flash-off" ofType:@"png"]]]; 74 | [_offView setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 75 | [self addSubview:_offView]; 76 | 77 | _unavailableView = [[UIImageView alloc] init]; 78 | [_unavailableView setAlpha:0.0f]; 79 | [_unavailableView setContentMode:UIViewContentModeCenter]; 80 | [_unavailableView setBackgroundColor:[UIColor clearColor]]; 81 | [_unavailableView setImage:[UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"flash-unavailable" ofType:@"png"]]]; 82 | [_unavailableView setTranslatesAutoresizingMaskIntoConstraints:FALSE]; 83 | [self addSubview:_unavailableView]; 84 | 85 | _value = PXFlashTypeAuto; 86 | } 87 | return self; 88 | } 89 | 90 | - (void)setOrientation:(PXFlashControlOrientation)orientation 91 | { 92 | _orientation = orientation; 93 | [self setNeedsUpdateConstraints]; 94 | [self updateConstraintsIfNeeded]; 95 | } 96 | 97 | - (NSArray*)individualViews 98 | { 99 | return @[_autoView, _offView, _onView, _unavailableView]; 100 | } 101 | 102 | - (void)updateConstraints 103 | { 104 | [self removeConstraints:[self constraints]]; 105 | 106 | NSDictionary* views = NSDictionaryOfVariableBindings(_autoView, _onView, _offView, _unavailableView); 107 | NSDictionary* metrics = @{@"bw" : @40}; 108 | 109 | if (_orientation == PXFlashControlOrientationPortrait) { 110 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_autoView]|" options:0 metrics:metrics views:views]]; 111 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_onView]|" options:0 metrics:metrics views:views]]; 112 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_offView]|" options:0 metrics:metrics views:views]]; 113 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_unavailableView]|" options:0 metrics:metrics views:views]]; 114 | 115 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_unavailableView(bw)]" options:0 metrics:metrics views:views]]; 116 | [self addConstraint:[NSLayoutConstraint constraintWithItem:_unavailableView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]]; 117 | 118 | [self addConstraint:[NSLayoutConstraint constraintWithItem:_onView attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]]; 119 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_autoView(bw)]" options:0 metrics:metrics views:views]]; 120 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_onView(bw)]" options:0 metrics:metrics views:views]]; 121 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[_offView(bw)]|" options:0 metrics:metrics views:views]]; 122 | } else { 123 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_autoView]|" options:0 metrics:metrics views:views]]; 124 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_onView]|" options:0 metrics:metrics views:views]]; 125 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_offView]|" options:0 metrics:metrics views:views]]; 126 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_unavailableView]|" options:0 metrics:metrics views:views]]; 127 | 128 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_unavailableView(bw)]" options:0 metrics:metrics views:views]]; 129 | [self addConstraint:[NSLayoutConstraint constraintWithItem:_unavailableView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0f constant:0.0f]]; 130 | 131 | [self addConstraint:[NSLayoutConstraint constraintWithItem:_onView attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0f constant:0.0f]]; 132 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_autoView(bw)]" options:0 metrics:metrics views:views]]; 133 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_onView(bw)]" options:0 metrics:metrics views:views]]; 134 | [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_offView(bw)]|" options:0 metrics:metrics views:views]]; 135 | } 136 | 137 | [super updateConstraints]; 138 | } 139 | 140 | - (void)setValue:(PXFlashType)value 141 | { 142 | _value = value; 143 | 144 | // make the correct one visible and ignore touches if set to unavailable 145 | if (_value == PXFlashTypeUnavailable) { 146 | _receivingTouches = FALSE; 147 | } else { 148 | _receivingTouches = TRUE; 149 | } 150 | 151 | [self collapse]; 152 | } 153 | 154 | - (void)collapse 155 | { 156 | switch (_value) { 157 | case PXFlashTypeAuto: { 158 | [_autoView setAlpha:1.0f]; 159 | [_onView setAlpha:0.0f]; 160 | [_offView setAlpha:0.0f]; 161 | [_unavailableView setAlpha:0.0f]; 162 | [self bringSubviewToFront:_autoView]; 163 | break; 164 | } 165 | 166 | case PXFlashTypeOn:{ 167 | [_autoView setAlpha:0.0f]; 168 | [_onView setAlpha:1.0f]; 169 | [_offView setAlpha:0.0f]; 170 | [_unavailableView setAlpha:0.0f]; 171 | [self bringSubviewToFront:_onView]; 172 | break; 173 | } 174 | 175 | case PXFlashTypeOff: { 176 | [_autoView setAlpha:0.0f]; 177 | [_onView setAlpha:0.0f]; 178 | [_offView setAlpha:1.0f]; 179 | [_unavailableView setAlpha:0.0f]; 180 | [self bringSubviewToFront:_offView]; 181 | break; 182 | } 183 | 184 | case PXFlashTypeUnavailable: 185 | default: { 186 | [_autoView setAlpha:0.0f]; 187 | [_onView setAlpha:0.0f]; 188 | [_offView setAlpha:0.0f]; 189 | [_unavailableView setAlpha:1.0f]; 190 | [self bringSubviewToFront:_unavailableView]; 191 | break; 192 | } 193 | } 194 | } 195 | 196 | - (void)expand 197 | { 198 | [_autoView setAlpha:1.0f]; 199 | [_onView setAlpha:1.0f]; 200 | [_offView setAlpha:1.0f]; 201 | } 202 | 203 | - (PXFlashType)value 204 | { 205 | return _value; 206 | } 207 | 208 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 209 | { 210 | if (!_receivingTouches) { 211 | return; 212 | } 213 | 214 | if (_expanded) { 215 | _fcState = PXFlashControlStateCollapsed; 216 | } else { 217 | _fcState = PXFlashControlStateExpanded; 218 | } 219 | 220 | if (_expanded) { 221 | // pick flash mode 222 | NSInteger newValue = [self resolveBinFromPrimaryAxis:[[touches anyObject] locationInView:self]]; 223 | 224 | // deal with state and events 225 | [self setValue:newValue]; 226 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 227 | _expanded = FALSE; 228 | 229 | } else { 230 | _expanded = TRUE; 231 | } 232 | [self sendActionsForControlEvents:UIControlEventTouchUpInside]; 233 | } 234 | 235 | - (NSInteger)resolveBinFromPrimaryAxis:(CGPoint)point 236 | { 237 | CGFloat axisCoordinate; 238 | CGFloat totalAxisLength; 239 | 240 | if (_orientation == PXFlashControlOrientationPortrait) { 241 | axisCoordinate = point.x; 242 | totalAxisLength = [self frame].size.width; 243 | } else { 244 | axisCoordinate = point.y; 245 | totalAxisLength = [self frame].size.height; 246 | } 247 | CGFloat binWidth = totalAxisLength / 3; 248 | 249 | return (NSInteger)(axisCoordinate / binWidth); 250 | } 251 | 252 | @end 253 | --------------------------------------------------------------------------------