├── CSPopKit ├── Assets │ └── .gitkeep └── Classes │ ├── .gitkeep │ ├── CSCustomPopManage │ ├── Basic │ │ ├── CSCustomPopModel.m │ │ ├── CSCustomPopModel.h │ │ ├── CSCustomPopViewLoader.h │ │ ├── CSCustomPopManagerHeader.h │ │ ├── CSCustomPopView.h │ │ ├── CSCustomPopManagerPrivate.h │ │ ├── CSCustomPopControllerLoader.h │ │ ├── CSCustomPopReformer.h │ │ ├── CSCustomPopViewLoader.m │ │ ├── CSCustomPopHandler.h │ │ ├── CSCustomPopView.m │ │ ├── CSCustomPopControllerLoader.m │ │ ├── CSCustomPopReformer.m │ │ ├── CSCustomPopHeader.h │ │ ├── CSCustomPopHandler.m │ │ ├── CSCustomPopManager.h │ │ └── CSCustomPopManager.m │ └── CSPopManager │ │ ├── CSPopViewPriority.h │ │ ├── CSPopPriorityProtocol.h │ │ ├── CSPopViewManager.h │ │ ├── CSCustomPopController.h │ │ ├── CSCustomPopController.m │ │ └── CSPopViewManager.m │ └── CSPopController │ ├── CSPopPriorityProtocol.h │ ├── CSPopControllerProviderProtocol.h │ ├── CSPopAnimation.h │ ├── CSPopController.h │ ├── CSPopTheme.m │ ├── CSPopTheme.h │ ├── CSPopAnimation.m │ └── CSPopController.m ├── _Pods.xcodeproj ├── Example ├── Tests │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── Tests-Prefix.pch │ ├── Tests.m │ └── Tests-Info.plist ├── CSPopKit │ ├── en.lproj │ │ └── InfoPlist.strings │ ├── CSViewController.h │ ├── PopTest │ │ ├── CSCustomPopTestView.h │ │ ├── CSCustomTestViewLoader.h │ │ ├── CSCustomPopLowProprityHandler.h │ │ ├── CSCustomPopHighProprityHandler.h │ │ ├── CSCustomTestPopLoader.h │ │ ├── CSCustomPopLowProprityHandler.m │ │ ├── CSCustomPopHighProprityHandler.m │ │ ├── CSCustomPopManagerTest.h │ │ ├── CSCustomTestViewLoader.m │ │ ├── CSCustomTestPopLoader.m │ │ ├── CSCustomPopTestView.m │ │ └── CSCustomPopManagerTest.m │ ├── CSAppDelegate.h │ ├── CSPopKit-Prefix.pch │ ├── main.m │ ├── CSViewController.m │ ├── CSPopKit-Info.plist │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ └── CSAppDelegate.m ├── Pods │ ├── Target Support Files │ │ ├── Masonry │ │ │ ├── Masonry.modulemap │ │ │ ├── Masonry-dummy.m │ │ │ ├── Masonry-prefix.pch │ │ │ ├── Masonry.xcconfig │ │ │ ├── Info.plist │ │ │ └── Masonry-umbrella.h │ │ ├── CSPopKit │ │ │ ├── CSPopKit.modulemap │ │ │ ├── CSPopKit-dummy.m │ │ │ ├── CSPopKit-prefix.pch │ │ │ ├── CSPopKit.xcconfig │ │ │ ├── ResourceBundle-CSPopKit-Info.plist │ │ │ ├── Info.plist │ │ │ └── CSPopKit-umbrella.h │ │ ├── Pods-CSPopKit_Tests │ │ │ ├── Pods-CSPopKit_Tests.modulemap │ │ │ ├── Pods-CSPopKit_Tests-dummy.m │ │ │ ├── Pods-CSPopKit_Tests-acknowledgements.markdown │ │ │ ├── Pods-CSPopKit_Tests-umbrella.h │ │ │ ├── Pods-CSPopKit_Tests.debug.xcconfig │ │ │ ├── Pods-CSPopKit_Tests.release.xcconfig │ │ │ ├── Info.plist │ │ │ ├── Pods-CSPopKit_Tests-acknowledgements.plist │ │ │ ├── Pods-CSPopKit_Tests-resources.sh │ │ │ └── Pods-CSPopKit_Tests-frameworks.sh │ │ └── Pods-CSPopKit_Example │ │ │ ├── Pods-CSPopKit_Example.modulemap │ │ │ ├── Pods-CSPopKit_Example-dummy.m │ │ │ ├── Pods-CSPopKit_Example-umbrella.h │ │ │ ├── Pods-CSPopKit_Example.debug.xcconfig │ │ │ ├── Pods-CSPopKit_Example.release.xcconfig │ │ │ ├── Info.plist │ │ │ ├── Pods-CSPopKit_Example-acknowledgements.markdown │ │ │ ├── Pods-CSPopKit_Example-acknowledgements.plist │ │ │ └── Pods-CSPopKit_Example-resources.sh │ ├── Masonry │ │ ├── Masonry │ │ │ ├── MASLayoutConstraint.m │ │ │ ├── NSLayoutConstraint+MASDebugAdditions.h │ │ │ ├── MASLayoutConstraint.h │ │ │ ├── MASCompositeConstraint.h │ │ │ ├── Masonry.h │ │ │ ├── ViewController+MASAdditions.h │ │ │ ├── NSArray+MASShorthandAdditions.h │ │ │ ├── MASViewAttribute.m │ │ │ ├── MASViewAttribute.h │ │ │ ├── ViewController+MASAdditions.m │ │ │ ├── MASViewConstraint.h │ │ │ ├── MASConstraint+Private.h │ │ │ ├── NSArray+MASAdditions.h │ │ │ ├── View+MASAdditions.h │ │ │ ├── View+MASShorthandAdditions.h │ │ │ ├── MASCompositeConstraint.m │ │ │ ├── MASConstraintMaker.h │ │ │ ├── NSLayoutConstraint+MASDebugAdditions.m │ │ │ ├── MASUtilities.h │ │ │ ├── NSArray+MASAdditions.m │ │ │ └── View+MASAdditions.m │ │ └── LICENSE │ ├── Manifest.lock │ └── Local Podspecs │ │ └── CSPopKit.podspec.json ├── Podfile ├── CSPopKit.xcodeproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── CSPopKit-Example.xcscheme ├── CSPopKit.xcworkspace │ └── contents.xcworkspacedata └── Podfile.lock ├── README ├── 屏幕快照 2018-04-04 下午11.39.12.png ├── 屏幕快照 2018-04-04 下午11.44.53.png └── 屏幕快照 2018-04-04 下午2.03.07.png ├── .travis.yml ├── .gitignore ├── LICENSE └── CSPopKit.podspec /CSPopKit/Assets/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CSPopKit/Classes/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_Pods.xcodeproj: -------------------------------------------------------------------------------- 1 | Example/Pods/Pods.xcodeproj -------------------------------------------------------------------------------- /Example/Tests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/CSPopKit/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /README/屏幕快照 2018-04-04 下午11.39.12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dormitory219/CSPopKit/HEAD/README/屏幕快照 2018-04-04 下午11.39.12.png -------------------------------------------------------------------------------- /README/屏幕快照 2018-04-04 下午11.44.53.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dormitory219/CSPopKit/HEAD/README/屏幕快照 2018-04-04 下午11.44.53.png -------------------------------------------------------------------------------- /README/屏幕快照 2018-04-04 下午2.03.07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dormitory219/CSPopKit/HEAD/README/屏幕快照 2018-04-04 下午2.03.07.png -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Masonry/Masonry.modulemap: -------------------------------------------------------------------------------- 1 | framework module Masonry { 2 | umbrella header "Masonry-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CSPopKit/CSPopKit.modulemap: -------------------------------------------------------------------------------- 1 | framework module CSPopKit { 2 | umbrella header "CSPopKit-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Tests/Tests-Prefix.pch: -------------------------------------------------------------------------------- 1 | // The contents of this file are implicitly included at the beginning of every test case source file. 2 | 3 | #ifdef __OBJC__ 4 | 5 | 6 | 7 | #endif 8 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Masonry/Masonry-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Masonry : NSObject 3 | @end 4 | @implementation PodsDummy_Masonry 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CSPopKit/CSPopKit-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_CSPopKit : NSObject 3 | @end 4 | @implementation PodsDummy_CSPopKit 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Podfile: -------------------------------------------------------------------------------- 1 | use_frameworks! 2 | 3 | target 'CSPopKit_Example' do 4 | pod 'CSPopKit', :path => '../' 5 | 6 | target 'CSPopKit_Tests' do 7 | inherit! :search_paths 8 | 9 | 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_Tests.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_CSPopKit_Tests { 2 | umbrella header "Pods-CSPopKit_Tests-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/Pods-CSPopKit_Example.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_CSPopKit_Example { 2 | umbrella header "Pods-CSPopKit_Example-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_Tests-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_CSPopKit_Tests : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_CSPopKit_Tests 5 | @end 6 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_Tests-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | Generated by CocoaPods - https://cocoapods.org 4 | -------------------------------------------------------------------------------- /Example/CSPopKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/Pods-CSPopKit_Example-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_CSPopKit_Example : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_CSPopKit_Example 5 | @end 6 | -------------------------------------------------------------------------------- /Example/CSPopKit/CSViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSViewController.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 04/03/2018. 6 | // Copyright (c) 2018 joy_yu. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface CSViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CSPopKit/CSPopKit-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/Masonry/Masonry-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 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopModel.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopModel.h" 10 | 11 | @implementation CSCustomPopModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/CSPopKit.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASLayoutConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASLayoutConstraint.h" 10 | 11 | @implementation MASLayoutConstraint 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomPopTestView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopTestView.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSCustomPopView.h" 11 | 12 | @interface CSCustomPopTestView : CSCustomPopView 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomTestViewLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomTestViewLoader.h 3 | // CSPopKit_Example 4 | // 5 | // Created by joy_yu on 2018/4/10. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopViewLoader.h" 10 | 11 | @interface CSCustomTestViewLoader : CSCustomPopViewLoader 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomPopLowProprityHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopLowProprityHandler.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopHandler.h" 10 | 11 | @interface CSCustomPopLowProprityHandler : CSCustomPopHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomPopHighProprityHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopHighProprityHandler.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopHandler.h" 10 | 11 | @interface CSCustomPopHighProprityHandler : CSCustomPopHandler 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Example/CSPopKit/CSAppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSAppDelegate.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 04/03/2018. 6 | // Copyright (c) 2018 joy_yu. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | 11 | @interface CSAppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomTestPopLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomTestPopController.h 3 | // CSPopKit_Example 4 | // 5 | // Created by joy_yu on 2018/4/10. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopControllerLoader.h" 10 | #import "CSCustomPopController.h" 11 | 12 | @interface CSCustomTestPopLoader : CSCustomPopControllerLoader 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopModel.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /* 12 | model组件 13 | 14 | 弹窗业务所需的model,该model可能是直接所需业务对象,也可能是数据包裹对象如数组 15 | */ 16 | 17 | @interface CSCustomPopModel : NSObject 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomPopLowProprityHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopLowProprityHandler.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopLowProprityHandler.h" 10 | 11 | @implementation CSCustomPopLowProprityHandler 12 | 13 | - (NSInteger)priority 14 | { 15 | return 10; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/CSPopKit/CSPopKit-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 UIKit; 15 | @import Foundation; 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomPopHighProprityHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopHighProprityHandler.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopHighProprityHandler.h" 10 | 11 | @implementation CSCustomPopHighProprityHandler 12 | 13 | - (NSInteger)priority 14 | { 15 | return 300; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Example/CSPopKit/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 04/03/2018. 6 | // Copyright (c) 2018 joy_yu. All rights reserved. 7 | // 8 | 9 | @import UIKit; 10 | #import "CSAppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) 13 | { 14 | @autoreleasepool { 15 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CSAppDelegate class])); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomPopManagerTest.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopManagerTest.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CSCustomPopManagerTest : NSObject 12 | 13 | + (void)testPopView; 14 | 15 | + (void)testRepeatPop; 16 | 17 | + (void)testMultiplePop; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/CSPopManager/CSPopViewPriority.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopViewPriority.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/5. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #ifndef CSPopViewPriority_h 10 | #define CSPopViewPriority_h 11 | 12 | static NSInteger KDefalutPopProprity = 100; 13 | 14 | static NSInteger KNewPremiumAccountPopProprity = 500; 15 | 16 | #endif /* CSPopViewPriority_h */ 17 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomTestViewLoader.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomTestViewLoader.m 3 | // CSPopKit_Example 4 | // 5 | // Created by joy_yu on 2018/4/10. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomTestViewLoader.h" 10 | #import "CSCustomPopTestView.h" 11 | 12 | @implementation CSCustomTestViewLoader 13 | 14 | - (CSCustomPopTestView *)view 15 | { 16 | return [CSCustomPopTestView popView]; 17 | } 18 | @end 19 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * makes debug and log output of NSLayoutConstraints more readable 13 | */ 14 | @interface NSLayoutConstraint (MASDebugAdditions) 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_Tests-umbrella.h: -------------------------------------------------------------------------------- 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 | 14 | FOUNDATION_EXPORT double Pods_CSPopKit_TestsVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_CSPopKit_TestsVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/Pods-CSPopKit_Example-umbrella.h: -------------------------------------------------------------------------------- 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 | 14 | FOUNDATION_EXPORT double Pods_CSPopKit_ExampleVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_CSPopKit_ExampleVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Example/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CSPopKit (0.1.0): 3 | - Masonry 4 | - Masonry (1.1.0) 5 | 6 | DEPENDENCIES: 7 | - CSPopKit (from `../`) 8 | 9 | SPEC REPOS: 10 | https://github.com/CocoaPods/Specs.git: 11 | - Masonry 12 | 13 | EXTERNAL SOURCES: 14 | CSPopKit: 15 | :path: "../" 16 | 17 | SPEC CHECKSUMS: 18 | CSPopKit: e0036425f804ad1693de2d0abb29a29a84f9bc49 19 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 20 | 21 | PODFILE CHECKSUM: 4b862423ee3bf76f79d2a08c7dca5f97c75ac26d 22 | 23 | COCOAPODS: 1.5.0.beta.1 24 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Masonry/Masonry.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Masonry 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = -framework "Foundation" -framework "UIKit" 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/Masonry 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Example/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - CSPopKit (0.1.0): 3 | - Masonry 4 | - Masonry (1.1.0) 5 | 6 | DEPENDENCIES: 7 | - CSPopKit (from `../`) 8 | 9 | SPEC REPOS: 10 | https://github.com/CocoaPods/Specs.git: 11 | - Masonry 12 | 13 | EXTERNAL SOURCES: 14 | CSPopKit: 15 | :path: "../" 16 | 17 | SPEC CHECKSUMS: 18 | CSPopKit: e0036425f804ad1693de2d0abb29a29a84f9bc49 19 | Masonry: 678fab65091a9290e40e2832a55e7ab731aad201 20 | 21 | PODFILE CHECKSUM: 4b862423ee3bf76f79d2a08c7dca5f97c75ac26d 22 | 23 | COCOAPODS: 1.5.0.beta.1 24 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CSPopKit/CSPopKit.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit 2 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 3 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 4 | PODS_BUILD_DIR = ${BUILD_DIR} 5 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 6 | PODS_ROOT = ${SRCROOT} 7 | PODS_TARGET_SRCROOT = ${PODS_ROOT}/../.. 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # references: 2 | # * http://www.objc.io/issue-6/travis-ci.html 3 | # * https://github.com/supermarin/xcpretty#usage 4 | 5 | osx_image: xcode7.3 6 | language: objective-c 7 | # cache: cocoapods 8 | # podfile: Example/Podfile 9 | # before_install: 10 | # - gem install cocoapods # Since Travis is not always on latest version 11 | # - pod install --project-directory=Example 12 | script: 13 | - set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/CSPopKit.xcworkspace -scheme CSPopKit-Example -sdk iphonesimulator9.3 ONLY_ACTIVE_ARCH=NO | xcpretty 14 | - pod lib lint 15 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopViewLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomViewLoader.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSCustomPopHeader.h" 11 | 12 | /* 13 | viewloader组件 14 | 15 | 该组件根据protocol提供对应弹窗业务所需的view(不是传统直接传view的方式,而是配置接口) 16 | 可根据data的类型配置不同的接口,在reformer中处理时根据data定制不同的view 17 | 18 | 实现的接口如下: 19 | CSCustomPopViewLoader:弹窗view的获取 20 | */ 21 | @interface CSCustomPopViewLoader : NSObject 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSPopController/CSPopPriorityProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopPriorityProtocol.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/5. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #ifndef CSPopPriorityProtocol_h 10 | #define CSPopPriorityProtocol_h 11 | 12 | /* 13 | 弹窗业务类中优先级业务需要遵守的协议: 14 | 1.优先级:优先级高,展示权限越高,反之,默认可传100. 15 | 2.dismiss:弹窗管理类需要根据权限将当前正在展示的但优先级低的弹窗dismiss掉 16 | */ 17 | 18 | @protocol CSPopPriorityProtocol 19 | 20 | @optional 21 | - (NSInteger)priority; 22 | 23 | - (void)dismissPopView; 24 | 25 | @end 26 | 27 | 28 | #endif /* CSPopPriorityProtocol_h */ 29 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopManagerHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopManagerHeader.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | #ifndef CSCustomPopManagerHeader_h 9 | #define CSCustomPopManagerHeader_h 10 | 11 | #import "CSCustomPopManager.h" 12 | 13 | #import "CSCustomPopHandler.h" 14 | #import "CSCustomPopViewLoader.h" 15 | #import "CSCustomPopControllerLoader.h" 16 | #import "CSCustomPopReformer.h" 17 | 18 | #import "CSCustomPopView.h" 19 | 20 | #import "CSCustomPopModel.h" 21 | 22 | 23 | #endif /* CSCustomPopManagerHeader_h */ 24 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/CSPopManager/CSPopPriorityProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopPriorityProtocol.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/5. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #ifndef CSPopPriorityProtocol_h 10 | #define CSPopPriorityProtocol_h 11 | 12 | /* 13 | 弹窗业务类中优先级业务需要遵守的协议: 14 | 1.优先级:优先级高,展示权限越高,反之,默认可传100. 15 | 2.dismiss:弹窗管理类需要根据权限将当前正在展示的但优先级低的弹窗dismiss掉 16 | */ 17 | 18 | @protocol CSPopPriorityProtocol 19 | 20 | @optional 21 | - (NSInteger)priority; 22 | 23 | - (void)dismissPopView; 24 | 25 | @end 26 | 27 | 28 | #endif /* CSPopPriorityProtocol_h */ 29 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASLayoutConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASLayoutConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * When you are debugging or printing the constraints attached to a view this subclass 13 | * makes it easier to identify which constraints have been created via Masonry 14 | */ 15 | @interface MASLayoutConstraint : NSLayoutConstraint 16 | 17 | /** 18 | * a key to associate with this constraint 19 | */ 20 | @property (nonatomic, strong) id mas_key; 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASCompositeConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | /** 13 | * A group of MASConstraint objects 14 | */ 15 | @interface MASCompositeConstraint : MASConstraint 16 | 17 | /** 18 | * Creates a composite with a predefined array of children 19 | * 20 | * @param children child MASConstraints 21 | * 22 | * @return a composite constraint 23 | */ 24 | - (id)initWithChildren:(NSArray *)children; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSPopController/CSPopControllerProviderProtocol.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopControllerProviderProtocol.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/4. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #ifndef CSPopControllerProviderProtocol_h 10 | #define CSPopControllerProviderProtocol_h 11 | 12 | #import 13 | 14 | @protocol CSPopControllerProviderProtocol 15 | 16 | - (instancetype)initWithContent:(UIView *)content; 17 | 18 | - (void)presentPopControllerAnimated:(BOOL)animated; 19 | 20 | - (void)dismissPopControllerAnimated:(BOOL)animated; 21 | 22 | @end 23 | 24 | #endif /* CSPopControllerProviderProtocol_h */ 25 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSPopController/CSPopAnimation.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopAnimationManager.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/4. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSPopTheme.h" 11 | #import "CSPopController.h" 12 | 13 | @interface CSPopAnimation : NSObject 14 | 15 | 16 | @property (nonatomic,strong) UIView *content; 17 | 18 | @property (nonatomic, strong) UIView *maskView; 19 | 20 | @property (nonatomic, strong) CSPopTheme *theme; 21 | 22 | @property (nonatomic, weak) CSPopController *popController; 23 | 24 | @property (nonatomic,assign) BOOL isNotDismiss; 25 | 26 | - (void)animationWithPop:(BOOL)isPop; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopView.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSCustomPopHeader.h" 11 | #import "CSCustomPopModel.h" 12 | 13 | /* 14 | view组件 15 | 16 | 该组件是弹窗的内容视图,在内部只需做好宽高自适应约束匹配即可做到自适应,其他的交给popController处理 17 | 可用xib,手动约束布局,视图容器必须是高度可知(容器内最底部子视图+下约束),否则异常(外部无法计算容器高度) 18 | 高度可知两种: 19 | 1.高度固定 20 | 2.高度自适应 21 | */ 22 | 23 | @interface CSCustomPopView : UIView 24 | 25 | @property (nonatomic,weak) id delegate; 26 | @property (nonatomic,strong) id data; 27 | 28 | + (instancetype)popView; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_Tests.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit" "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit/CSPopKit.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Masonry/Masonry.framework/Headers" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_Tests.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit" "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit/CSPopKit.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Masonry/Masonry.framework/Headers" 5 | PODS_BUILD_DIR = ${BUILD_DIR} 6 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 7 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 8 | PODS_ROOT = ${SRCROOT}/Pods 9 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSPopController/CSPopController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopController.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/4. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "CSPopTheme.h" 12 | #import "CSPopControllerProviderProtocol.h" 13 | 14 | extern NSString *const CSPopControllerDissmissNotification; 15 | 16 | @interface CSPopController : NSObject 17 | 18 | @property (nonatomic,strong) CSPopTheme *theme; 19 | 20 | - (instancetype)initWithContent:(UIView *)content; 21 | 22 | - (void)presentPopControllerAnimated:(BOOL)animated; 23 | 24 | - (void)dismissPopControllerAnimated:(BOOL)animated; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/CSPopManager/CSPopViewManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopViewManager.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/5. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSPopPriorityProtocol.h" 11 | 12 | /* 13 | 弹窗管理类,管理程序内所有自定义弹窗: 14 | 1.当前无弹窗: 15 | 展示当前弹窗 16 | 17 | 2.当前已经至少有一个弹窗 18 | 1.判断是否展示重复的弹窗(同一个弹窗present两次),若重复,取消当前present; 19 | 2.判断当前优先级的弹窗是否可展示:优先级低,当前弹窗不展示,优先级高,当前弹窗展示,并dismiss调目前正在展示优先级低于当前弹窗的弹窗 20 | 21 | */ 22 | 23 | @interface CSPopViewManager : NSObject 24 | 25 | + (CSPopViewManager *)sharedManager; 26 | 27 | - (BOOL)addPop:(id)pop; 28 | 29 | - (void)removePop:(id)pop; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Example/Tests/Tests.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopKitTests.m 3 | // CSPopKitTests 4 | // 5 | // Created by joy_yu on 04/03/2018. 6 | // Copyright (c) 2018 joy_yu. All rights reserved. 7 | // 8 | 9 | @import XCTest; 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 | 36 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/CSPopManager/CSCustomPopController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopController.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/5. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSPopControllerProviderProtocol.h" 11 | #import "CSPopController.h" 12 | /* 13 | 每个弹窗业务管理类中自定义弹窗样式:供弹窗业务继承 14 | 注意: 15 | 1.该空间提供自适应支持的条件是,自定义视图满足自适应宽高的约束:常见底部约束: 16 | */ 17 | 18 | @interface CSCustomPopController : NSObject 19 | 20 | @property (nonatomic,strong) id popController; 21 | 22 | - (instancetype)initWithContent:(UIView *)content; 23 | 24 | - (void)presentPopControllerAnimated:(BOOL)animated; 25 | 26 | - (void)dismissPopControllerAnimated:(BOOL)animated; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopManagerPrivate.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopManagerPrivate.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #ifndef CSCustomPopManagerPrivate_h 10 | #define CSCustomPopManagerPrivate_h 11 | 12 | #import "CSPopViewManager.h" 13 | 14 | #import "CSCustomPopHandler.h" 15 | #import "CSCustomPopReformer.h" 16 | #import "CSCustomPopViewLoader.h" 17 | #import "CSCustomPopControllerLoader.h" 18 | #import "CSCustomPopView.h" 19 | 20 | @interface CSCustomPopManager() 21 | 22 | @property (nonatomic,strong) NSMutableArray> *handlers; 23 | 24 | @end 25 | 26 | #endif /* CSCustomPopManagerPrivate_h */ 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/Pods-CSPopKit_Example.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit" "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit/CSPopKit.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Masonry/Masonry.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "CSPopKit" -framework "Masonry" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/Pods-CSPopKit_Example.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit" "${PODS_CONFIGURATION_BUILD_DIR}/Masonry" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 4 | OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/CSPopKit/CSPopKit.framework/Headers" -iquote "${PODS_CONFIGURATION_BUILD_DIR}/Masonry/Masonry.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "CSPopKit" -framework "Masonry" 6 | PODS_BUILD_DIR = ${BUILD_DIR} 7 | PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) 8 | PODS_PODFILE_DIR_PATH = ${SRCROOT}/. 9 | PODS_ROOT = ${SRCROOT}/Pods 10 | -------------------------------------------------------------------------------- /.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 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 26 | # Carthage/Checkouts 27 | 28 | Carthage/Build 29 | 30 | # We recommend against adding the Pods directory to your .gitignore. However 31 | # you should judge for yourself, the pros and cons are mentioned at: 32 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 33 | # 34 | # Note: if you ignore the Pods directory, make sure to uncomment 35 | # `pod install` in .travis.yml 36 | # 37 | # Pods/ 38 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CSPopKit/ResourceBundle-CSPopKit-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.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Example/Pods/Local Podspecs/CSPopKit.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CSPopKit", 3 | "version": "0.1.0", 4 | "summary": "A short description of CSPopKit.", 5 | "description": "TODO: Add long description of the pod here.", 6 | "homepage": "https://github.com/dormitory219/CSPopKit", 7 | "license": { 8 | "type": "MIT", 9 | "file": "LICENSE" 10 | }, 11 | "authors": { 12 | "dormitory219": "289067005@qq.com" 13 | }, 14 | "source": { 15 | "git": "https://github.com/dormitory219/CSPopKit.git", 16 | "tag": "0.1.0" 17 | }, 18 | "platforms": { 19 | "ios": "8.0" 20 | }, 21 | "source_files": "CSPopKit/Classes/**/*.{h,m}", 22 | "resource_bundles": { 23 | "CSPopKit": [ 24 | "CSPopKit/Classes/CSCustomPopManage/Basic/*.xib" 25 | ] 26 | }, 27 | "public_header_files": "CSPopKit/Classes/**/*.h", 28 | "dependencies": { 29 | "Masonry": [ 30 | 31 | ] 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopControllerLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopLoader.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSCustomPopHeader.h" 11 | #import "CSPopControllerProviderProtocol.h" 12 | 13 | /* 14 | popControllerLoader组件 15 | 16 | 该组件是一个弹窗展示的容器, 17 | 包裹一个遵守CSPopControllerProviderProtocol协议的pop控件,该控件提供pop样式,包括圆角,宽高,中心位置,偏移,present,dismiss动画等相关。目前该控件统一使用CSPopController 18 | 19 | 实现的接口如下: 20 | CSCustomPopControllerLoader:初始化方法,视窗view设置业务 21 | CSPopControllerProviderProtocol:弹窗控件调用present ,dismiss,init的接口方法 22 | */ 23 | 24 | @interface CSCustomPopControllerLoader :NSObject 25 | 26 | @property (nonatomic,strong) id popController; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/Masonry.h: -------------------------------------------------------------------------------- 1 | // 2 | // Masonry.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for Masonry. 12 | FOUNDATION_EXPORT double MasonryVersionNumber; 13 | 14 | //! Project version string for Masonry. 15 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 16 | 17 | #import "MASUtilities.h" 18 | #import "View+MASAdditions.h" 19 | #import "View+MASShorthandAdditions.h" 20 | #import "ViewController+MASAdditions.h" 21 | #import "NSArray+MASAdditions.h" 22 | #import "NSArray+MASShorthandAdditions.h" 23 | #import "MASConstraint.h" 24 | #import "MASCompositeConstraint.h" 25 | #import "MASViewAttribute.h" 26 | #import "MASViewConstraint.h" 27 | #import "MASConstraintMaker.h" 28 | #import "MASLayoutConstraint.h" 29 | #import "NSLayoutConstraint+MASDebugAdditions.h" 30 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopReformer.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopReformer.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSCustomPopHeader.h" 11 | 12 | /* 13 | popReformer组件 14 | 15 | 该组件提供view,model的数据绑定,在popController外部组件为空时内部定制view的pop样式,一般业务时比较轻量,当同一业务可能需要多种view展示时,在reformer中可按照具体逻辑处理(如高级账号业务,根据model类型,可能展示点券高级账号购买,点券购买,高级账号购买,点券使用等不同弹窗view) 16 | 17 | 可做的事情有: 18 | 1.根据数据model匹配弹窗view的展示, 19 | fetchPopViewWithModel:(CSCustomPopModel *)model viewLoader:(id)viewLoader 20 | 21 | 2.为view根据model定制不同的popController样式 22 | fetchPopControllerWithModel:(CSCustomPopModel *)model viewLoader:(id)viewLoader; 23 | 24 | 实现的接口如下: 25 | CSCustomReformerProtocol:如上 26 | */ 27 | 28 | @interface CSCustomPopReformer : NSObject 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CSPopKit/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 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 0.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Masonry/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 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Masonry/Masonry-umbrella.h: -------------------------------------------------------------------------------- 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 | #import "MASCompositeConstraint.h" 14 | #import "MASConstraint+Private.h" 15 | #import "MASConstraint.h" 16 | #import "MASConstraintMaker.h" 17 | #import "MASLayoutConstraint.h" 18 | #import "Masonry.h" 19 | #import "MASUtilities.h" 20 | #import "MASViewAttribute.h" 21 | #import "MASViewConstraint.h" 22 | #import "NSArray+MASAdditions.h" 23 | #import "NSArray+MASShorthandAdditions.h" 24 | #import "NSLayoutConstraint+MASDebugAdditions.h" 25 | #import "View+MASAdditions.h" 26 | #import "View+MASShorthandAdditions.h" 27 | #import "ViewController+MASAdditions.h" 28 | 29 | FOUNDATION_EXPORT double MasonryVersionNumber; 30 | FOUNDATION_EXPORT const unsigned char MasonryVersionString[]; 31 | 32 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_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 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/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 | CFBundleName 14 | ${PRODUCT_NAME} 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_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 | Generated by CocoaPods - https://cocoapods.org 18 | Title 19 | 20 | Type 21 | PSGroupSpecifier 22 | 23 | 24 | StringsTable 25 | Acknowledgements 26 | Title 27 | Acknowledgements 28 | 29 | 30 | -------------------------------------------------------------------------------- /Example/CSPopKit/CSViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSViewController.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 04/03/2018. 6 | // Copyright (c) 2018 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSViewController.h" 10 | #import "CSCustomPopManagerTest.h" 11 | 12 | @interface CSViewController () 13 | 14 | @end 15 | 16 | @implementation CSViewController 17 | 18 | - (void)viewDidLoad 19 | { 20 | [super viewDidLoad]; 21 | 22 | // Do any additional setup after loading the view, typically from a nib. 23 | } 24 | 25 | - (void)didReceiveMemoryWarning 26 | { 27 | [super didReceiveMemoryWarning]; 28 | // Dispose of any resources that can be recreated. 29 | } 30 | 31 | - (IBAction)testPopView:(id)sender 32 | { 33 | [CSCustomPopManagerTest testPopView]; 34 | } 35 | 36 | - (IBAction)testRepeatPop:(id)sender 37 | { 38 | [CSCustomPopManagerTest testRepeatPop]; 39 | } 40 | 41 | - (IBAction)testMultiplePop:(id)sender 42 | { 43 | [CSCustomPopManagerTest testMultiplePop]; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomTestPopLoader.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomTestPopController.m 3 | // CSPopKit_Example 4 | // 5 | // Created by joy_yu on 2018/4/10. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomTestPopLoader.h" 10 | 11 | @implementation CSCustomTestPopLoader 12 | 13 | - (void)setContent:(UIView *)content 14 | { 15 | CSPopController *popController = [[CSPopController alloc] initWithContent:content]; 16 | CSPopTheme *theme = [[CSPopTheme alloc] init]; 17 | theme.maskTypeTheme(CSPopThemeMaskTypeDimmed).cornerRadiusTheme(16.0f).maxPopupWidthTheme(280.0f).animationPresentionDurationTheme(0.6f).animationDismissDurationTheme(0.6f).shouldDismissOnBackgroundTouchTheme(NO).popThemePresentationStyleTheme(CSPPopThemePresentationStyleSlideInFromTopAndAngleBounce).popThemeDismissStyleTheme(CSPPopThemeDismissStyleSlideInToBottomAndAngle).horizontalOffsetTheme(0.f).verticalOffsetTheme(0.f); 18 | 19 | popController.theme = theme; 20 | self.popController = popController; 21 | } 22 | 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/ViewController+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | #ifdef MAS_VIEW_CONTROLLER 14 | 15 | @interface MAS_VIEW_CONTROLLER (MASAdditions) 16 | 17 | /** 18 | * following properties return a new MASViewAttribute with appropriate UILayoutGuide and NSLayoutAttribute 19 | */ 20 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuide; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuide; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideTop; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topLayoutGuideBottom; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideTop; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomLayoutGuideBottom; 26 | 27 | 28 | @end 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/CSPopKit/CSPopKit-umbrella.h: -------------------------------------------------------------------------------- 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 | #import "CSCustomPopControllerLoader.h" 14 | #import "CSCustomPopHandler.h" 15 | #import "CSCustomPopHeader.h" 16 | #import "CSCustomPopManager.h" 17 | #import "CSCustomPopManagerHeader.h" 18 | #import "CSCustomPopManagerPrivate.h" 19 | #import "CSCustomPopModel.h" 20 | #import "CSCustomPopReformer.h" 21 | #import "CSCustomPopView.h" 22 | #import "CSCustomPopViewLoader.h" 23 | #import "CSCustomPopController.h" 24 | #import "CSPopPriorityProtocol.h" 25 | #import "CSPopViewManager.h" 26 | #import "CSPopViewPriority.h" 27 | #import "CSPopAnimation.h" 28 | #import "CSPopController.h" 29 | #import "CSPopControllerProviderProtocol.h" 30 | #import "CSPopPriorityProtocol.h" 31 | #import "CSPopTheme.h" 32 | 33 | FOUNDATION_EXPORT double CSPopKitVersionNumber; 34 | FOUNDATION_EXPORT const unsigned char CSPopKitVersionString[]; 35 | 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 joy_yu <289067005@qq.com> 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 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopViewLoader.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomViewLoader.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopViewLoader.h" 10 | #import "CSCustomPopView.h" 11 | //#import "CSCustomPopNoXibView.h" 12 | 13 | @implementation CSCustomPopViewLoader 14 | 15 | + (instancetype)loader 16 | { 17 | return [[self alloc] init]; 18 | } 19 | 20 | - (CSCustomPopView *)view 21 | { 22 | return [CSCustomPopView popView]; 23 | // return [CSCustomPopNoXibView popView]; 24 | } 25 | 26 | //- (CSCustomPopView *)viewWithData:(id)data 27 | //{ 28 | // /* 29 | // do sth 30 | // if ([data isKindOfClass:[CSCustomPopModel class]]) 31 | // { 32 | // return [CSCustomPopView popView]; 33 | // } 34 | // 35 | // else if ([data isKindOfClass:[NSArray class]]) 36 | // { 37 | // return [UIView new]; 38 | // } 39 | // else 40 | // { 41 | // return [CSCustomPopView popView]; 42 | // } 43 | // */ 44 | // return [CSCustomPopView popView]; 45 | //} 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopHandler.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopHandler.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CSCustomPopHeader.h" 11 | #import "CSPopPriorityProtocol.h" 12 | #import "CSPopControllerProviderProtocol.h" 13 | /* 14 | handler组件 15 | 16 | handler为每种弹窗的业务中心处理类,该类作用是轻量manager,分离manager里不同弹窗的业务(manager+category的处理方式或许不是最明智?):比如升级新特性业务,贺卡引导业务,贺卡新特性引导业务 17 | 从manager里持有外部的fromViewController,popController样式,completeBlock回调,以及该弹窗的优先级处理,并持有弹窗视图view,如果view需要数据支持,在handler中应完成数据的初始化操作 18 | 19 | 注意,处理的业务逻辑比较多,但并不包括根据数据model匹配弹窗view的展示和为view根据model定制不同的popController样式,该逻辑抽离到reformer中专门处理(当然不细粒度分的话reformer的逻辑可以完全移到handler中去做)。 20 | 21 | 不同的业务即使业务相近,也最好不要共用handler,涉及优先级等无法区分处理了 22 | 23 | 实现的接口如下: 24 | CSCustomPopHandlerProtocol:弹窗业务将显示,已显示,取消显示,是否显示等业务,以及相关属性 25 | CSCustomPopViewProrocol:弹窗关闭业务处理 26 | CSPopPriorityProtocol:弹窗优先级相关 27 | */ 28 | 29 | @interface CSCustomPopHandler : NSObject 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 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. -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/NSArray+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSArray+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand array additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface NSArray (MASShorthandAdditions) 18 | 19 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 20 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 21 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 22 | 23 | @end 24 | 25 | @implementation NSArray (MASShorthandAdditions) 26 | 27 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *))block { 28 | return [self mas_makeConstraints:block]; 29 | } 30 | 31 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *))block { 32 | return [self mas_updateConstraints:block]; 33 | } 34 | 35 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *))block { 36 | return [self mas_remakeConstraints:block]; 37 | } 38 | 39 | @end 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/CSPopManager/CSCustomPopController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopController.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/5. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopController.h" 10 | 11 | @implementation CSCustomPopController 12 | 13 | - (instancetype)initWithContent:(UIView *)content 14 | { 15 | self = [super init]; 16 | if (self) 17 | { 18 | CSPopController *popController = [[CSPopController alloc] initWithContent:content]; 19 | popController.theme = [CSPopTheme defaultTheme]; 20 | self.popController = popController; 21 | } 22 | return self; 23 | } 24 | 25 | 26 | - (void)presentPopControllerAnimated:(BOOL)animated 27 | { 28 | if (self.popController && [self.popController respondsToSelector:@selector(presentPopControllerAnimated:)]) 29 | { 30 | [self.popController presentPopControllerAnimated:YES]; 31 | } 32 | } 33 | 34 | - (void)dismissPopControllerAnimated:(BOOL)animated 35 | { 36 | if (self.popController && [self.popController respondsToSelector:@selector(dismissPopControllerAnimated:)]) 37 | { 38 | [self.popController dismissPopControllerAnimated:YES]; 39 | } 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASViewAttribute.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttribute.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | 11 | @implementation MASViewAttribute 12 | 13 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute { 14 | self = [self initWithView:view item:view layoutAttribute:layoutAttribute]; 15 | return self; 16 | } 17 | 18 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute { 19 | self = [super init]; 20 | if (!self) return nil; 21 | 22 | _view = view; 23 | _item = item; 24 | _layoutAttribute = layoutAttribute; 25 | 26 | return self; 27 | } 28 | 29 | - (BOOL)isSizeAttribute { 30 | return self.layoutAttribute == NSLayoutAttributeWidth 31 | || self.layoutAttribute == NSLayoutAttributeHeight; 32 | } 33 | 34 | - (BOOL)isEqual:(MASViewAttribute *)viewAttribute { 35 | if ([viewAttribute isKindOfClass:self.class]) { 36 | return self.view == viewAttribute.view 37 | && self.layoutAttribute == viewAttribute.layoutAttribute; 38 | } 39 | return [super isEqual:viewAttribute]; 40 | } 41 | 42 | - (NSUInteger)hash { 43 | return MAS_NSUINTROTATE([self.view hash], MAS_NSUINT_BIT / 2) ^ self.layoutAttribute; 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASViewAttribute.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewAttribute.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | 11 | /** 12 | * An immutable tuple which stores the view and the related NSLayoutAttribute. 13 | * Describes part of either the left or right hand side of a constraint equation 14 | */ 15 | @interface MASViewAttribute : NSObject 16 | 17 | /** 18 | * The view which the reciever relates to. Can be nil if item is not a view. 19 | */ 20 | @property (nonatomic, weak, readonly) MAS_VIEW *view; 21 | 22 | /** 23 | * The item which the reciever relates to. 24 | */ 25 | @property (nonatomic, weak, readonly) id item; 26 | 27 | /** 28 | * The attribute which the reciever relates to 29 | */ 30 | @property (nonatomic, assign, readonly) NSLayoutAttribute layoutAttribute; 31 | 32 | /** 33 | * Convenience initializer. 34 | */ 35 | - (id)initWithView:(MAS_VIEW *)view layoutAttribute:(NSLayoutAttribute)layoutAttribute; 36 | 37 | /** 38 | * The designated initializer. 39 | */ 40 | - (id)initWithView:(MAS_VIEW *)view item:(id)item layoutAttribute:(NSLayoutAttribute)layoutAttribute; 41 | 42 | /** 43 | * Determine whether the layoutAttribute is a size attribute 44 | * 45 | * @return YES if layoutAttribute is equal to NSLayoutAttributeWidth or NSLayoutAttributeHeight 46 | */ 47 | - (BOOL)isSizeAttribute; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/ViewController+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Craig Siemens on 2015-06-23. 6 | // 7 | // 8 | 9 | #import "ViewController+MASAdditions.h" 10 | 11 | #ifdef MAS_VIEW_CONTROLLER 12 | 13 | @implementation MAS_VIEW_CONTROLLER (MASAdditions) 14 | 15 | - (MASViewAttribute *)mas_topLayoutGuide { 16 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 17 | } 18 | - (MASViewAttribute *)mas_topLayoutGuideTop { 19 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 20 | } 21 | - (MASViewAttribute *)mas_topLayoutGuideBottom { 22 | return [[MASViewAttribute alloc] initWithView:self.view item:self.topLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 23 | } 24 | 25 | - (MASViewAttribute *)mas_bottomLayoutGuide { 26 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 27 | } 28 | - (MASViewAttribute *)mas_bottomLayoutGuideTop { 29 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 30 | } 31 | - (MASViewAttribute *)mas_bottomLayoutGuideBottom { 32 | return [[MASViewAttribute alloc] initWithView:self.view item:self.bottomLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 33 | } 34 | 35 | 36 | 37 | @end 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASViewConstraint.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASViewConstraint.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASViewAttribute.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | #import "MASUtilities.h" 13 | 14 | /** 15 | * A single constraint. 16 | * Contains the attributes neccessary for creating a NSLayoutConstraint and adding it to the appropriate view 17 | */ 18 | @interface MASViewConstraint : MASConstraint 19 | 20 | /** 21 | * First item/view and first attribute of the NSLayoutConstraint 22 | */ 23 | @property (nonatomic, strong, readonly) MASViewAttribute *firstViewAttribute; 24 | 25 | /** 26 | * Second item/view and second attribute of the NSLayoutConstraint 27 | */ 28 | @property (nonatomic, strong, readonly) MASViewAttribute *secondViewAttribute; 29 | 30 | /** 31 | * initialises the MASViewConstraint with the first part of the equation 32 | * 33 | * @param firstViewAttribute view.mas_left, view.mas_width etc. 34 | * 35 | * @return a new view constraint 36 | */ 37 | - (id)initWithFirstViewAttribute:(MASViewAttribute *)firstViewAttribute; 38 | 39 | /** 40 | * Returns all MASViewConstraints installed with this view as a first item. 41 | * 42 | * @param view A view to retrieve constraints for. 43 | * 44 | * @return An array of MASViewConstraints. 45 | */ 46 | + (NSArray *)installedConstraintsForView:(MAS_VIEW *)view; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /CSPopKit.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod lib lint CSPopKit.podspec' to ensure this is a 3 | # valid spec before submitting. 4 | # 5 | # Any lines starting with a # are optional, but their use is encouraged 6 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | s.name = 'CSPopKit' 11 | s.version = '0.1.0' 12 | s.summary = 'A short description of CSPopKit.' 13 | 14 | # This description is used to generate tags and improve search results. 15 | # * Think: What does it do? Why did you write it? What is the focus? 16 | # * Try to keep it short, snappy and to the point. 17 | # * Write the description between the DESC delimiters below. 18 | # * Finally, don't worry about the indent, CocoaPods strips it! 19 | 20 | s.description = <<-DESC 21 | TODO: Add long description of the pod here. 22 | DESC 23 | 24 | s.homepage = 'https://github.com/joy_yu/CSPopKit' 25 | # s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2' 26 | s.license = { :type => 'MIT', :file => 'LICENSE' } 27 | s.author = { 'joy_yu' => '289067005@qq.com' } 28 | s.source = { :git => 'https://github.com/joy_yu/CSPopKit.git', :tag => s.version.to_s } 29 | # s.social_media_url = 'https://twitter.com/' 30 | 31 | s.ios.deployment_target = '8.0' 32 | 33 | s.source_files = 'CSPopKit/Classes/**/*.{h,m}' 34 | 35 | s.resource_bundles = { 36 | 'CSPopKit' => ['CSPopKit/Classes/CSCustomPopManage/Basic/*.xib'] 37 | } 38 | 39 | s.public_header_files = 'CSPopKit/Classes/**/*.h' 40 | # s.frameworks = 'UIKit', 'MapKit' 41 | s.dependency 'Masonry' 42 | end 43 | -------------------------------------------------------------------------------- /Example/CSPopKit/CSPopKit-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 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopView.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopView.h" 10 | 11 | @interface CSCustomPopView() 12 | 13 | @property (weak, nonatomic) IBOutlet UILabel *titleLabel; 14 | 15 | @end 16 | 17 | @implementation CSCustomPopView 18 | 19 | - (void)dealloc 20 | { 21 | NSLog(@"popView dealloc"); 22 | } 23 | 24 | + (instancetype)popView 25 | { 26 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 27 | NSString *bundleName = bundle.infoDictionary[@"CFBundleName"]; 28 | bundleName = [NSString stringWithFormat:@"%@.bundle",bundleName]; 29 | NSString *nibName = [NSString stringWithFormat:@"%@/%@",bundleName,NSStringFromClass([self class])]; 30 | return [bundle loadNibNamed:nibName owner:self options:nil].lastObject; 31 | } 32 | 33 | - (void)awakeFromNib 34 | { 35 | [super awakeFromNib]; 36 | self.layer.masksToBounds = YES; 37 | NSArray *texts = @[ 38 | @"这是一个默认弹窗", 39 | @"这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗", 40 | @"这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗", 41 | @"这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗\n这是一个默认弹窗", 42 | ]; 43 | self.titleLabel.text = texts[arc4random_uniform(4)]; 44 | } 45 | 46 | - (IBAction)dismissAction:(id)sender 47 | { 48 | NSLog(@"dismiss popView type:%@,data:%@",NSStringFromClass([self class]),self.data); 49 | if (self.delegate && [self.delegate respondsToSelector:@selector(dismissPopView:)]) 50 | { 51 | [self.delegate dismissPopView:self]; 52 | } 53 | } 54 | 55 | - (void)setData:(id)data 56 | { 57 | _data = data; 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Example/CSPopKit/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /Example/CSPopKit/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" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASConstraint+Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraint+Private.h 3 | // Masonry 4 | // 5 | // Created by Nick Tymchenko on 29/04/14. 6 | // Copyright (c) 2014 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | 11 | @protocol MASConstraintDelegate; 12 | 13 | 14 | @interface MASConstraint () 15 | 16 | /** 17 | * Whether or not to check for an existing constraint instead of adding constraint 18 | */ 19 | @property (nonatomic, assign) BOOL updateExisting; 20 | 21 | /** 22 | * Usually MASConstraintMaker but could be a parent MASConstraint 23 | */ 24 | @property (nonatomic, weak) id delegate; 25 | 26 | /** 27 | * Based on a provided value type, is equal to calling: 28 | * NSNumber - setOffset: 29 | * NSValue with CGPoint - setPointOffset: 30 | * NSValue with CGSize - setSizeOffset: 31 | * NSValue with MASEdgeInsets - setInsets: 32 | */ 33 | - (void)setLayoutConstantWithValue:(NSValue *)value; 34 | 35 | @end 36 | 37 | 38 | @interface MASConstraint (Abstract) 39 | 40 | /** 41 | * Sets the constraint relation to given NSLayoutRelation 42 | * returns a block which accepts one of the following: 43 | * MASViewAttribute, UIView, NSValue, NSArray 44 | * see readme for more details. 45 | */ 46 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation; 47 | 48 | /** 49 | * Override to set a custom chaining behaviour 50 | */ 51 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 52 | 53 | @end 54 | 55 | 56 | @protocol MASConstraintDelegate 57 | 58 | /** 59 | * Notifies the delegate when the constraint needs to be replaced with another constraint. For example 60 | * A MASViewConstraint may turn into a MASCompositeConstraint when an array is passed to one of the equality blocks 61 | */ 62 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint; 63 | 64 | - (MASConstraint *)constraint:(MASConstraint *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopControllerLoader.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopLoader.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopControllerLoader.h" 10 | #import "CSPopController.h" 11 | 12 | @implementation CSCustomPopControllerLoader 13 | 14 | + (instancetype)loader 15 | { 16 | return [[self alloc] init]; 17 | } 18 | 19 | - (instancetype)initWithContent:(UIView *)content 20 | { 21 | self = [super init]; 22 | if (self) 23 | { 24 | 25 | } 26 | return self; 27 | } 28 | 29 | - (void)presentPopControllerAnimated:(BOOL)animated 30 | { 31 | if (self.popController && [self.popController respondsToSelector:@selector(presentPopControllerAnimated:)]) 32 | { 33 | [self.popController presentPopControllerAnimated:YES]; 34 | } 35 | } 36 | 37 | - (void)dismissPopControllerAnimated:(BOOL)animated 38 | { 39 | if (self.popController && [self.popController respondsToSelector:@selector(dismissPopControllerAnimated:)]) 40 | { 41 | [self.popController dismissPopControllerAnimated:YES]; 42 | } 43 | } 44 | 45 | - (void)setContent:(UIView *)content 46 | { 47 | CSPopController *popController = [[CSPopController alloc] initWithContent:content]; 48 | self.popController = popController; 49 | 50 | CSPopTheme *theme = [CSPopTheme defaultTheme]; 51 | popController.theme = theme; 52 | } 53 | 54 | //- (void)setContent:(UIView *)content data:(id)data 55 | //{ 56 | // // do sth 57 | // /* 58 | // CSPopController *popController = [[CSPopController alloc] initWithContent:content]; 59 | // self.popController = popController; 60 | // 61 | // CSPopTheme *theme = [[CSPopTheme alloc] init]; 62 | // theme.maskTypeTheme(CSPopThemeMaskTypeDimmed).cornerRadiusTheme(6.0f).maxPopupWidthTheme(280.0f).animationDurationTheme(0.3f).shouldDismissOnBackgroundTouchTheme(NO).popThemePresentationStyleTheme(CSPPopThemePresentationStyleFadeIn).popThemeDismissStyleTheme(CSPPopThemeDismissStyleFadeOut); 63 | // popController.theme = theme; 64 | // */ 65 | //} 66 | 67 | 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /Example/CSPopKit/CSAppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSAppDelegate.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 04/03/2018. 6 | // Copyright (c) 2018 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSAppDelegate.h" 10 | 11 | @implementation CSAppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application 42 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomPopTestView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopTestView.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopTestView.h" 10 | 11 | @implementation CSCustomPopTestView 12 | 13 | - (void)dealloc 14 | { 15 | NSLog(@"popView dealloc"); 16 | } 17 | 18 | + (instancetype)popView 19 | { 20 | return [[self alloc] initWithFrame:CGRectZero]; 21 | } 22 | 23 | - (instancetype)initWithFrame:(CGRect)frame 24 | { 25 | self = [super initWithFrame:frame]; 26 | if (self) { 27 | 28 | self.backgroundColor = [ UIColor greenColor]; 29 | 30 | UIButton *dismissButton = [[UIButton alloc]init]; 31 | dismissButton.backgroundColor = [UIColor cyanColor]; 32 | [dismissButton setTitle:@"dismiss" forState:UIControlStateNormal]; 33 | [dismissButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 34 | [dismissButton addTarget:self action:@selector(dismissAction:) forControlEvents:UIControlEventTouchUpInside]; 35 | [self addSubview:dismissButton]; 36 | 37 | dismissButton.translatesAutoresizingMaskIntoConstraints = NO; 38 | [dismissButton.topAnchor constraintEqualToAnchor:self.topAnchor constant:25].active = YES; 39 | [dismissButton.centerXAnchor constraintEqualToAnchor:self.centerXAnchor constant:0].active = YES; 40 | 41 | UIView *containView = [[UIView alloc]init]; 42 | containView.backgroundColor = [UIColor orangeColor]; 43 | [self addSubview:containView]; 44 | 45 | containView.translatesAutoresizingMaskIntoConstraints = NO; 46 | [containView.topAnchor constraintEqualToAnchor:dismissButton.bottomAnchor constant:25].active = YES; 47 | [containView.leftAnchor constraintEqualToAnchor:self.leftAnchor constant:25].active = YES; 48 | [containView.rightAnchor constraintEqualToAnchor:self.rightAnchor constant:-25].active = YES; 49 | [containView.heightAnchor constraintEqualToConstant:120].active = YES; 50 | 51 | //关键下约束 52 | [containView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor constant:-25].active = YES; 53 | } 54 | return self; 55 | } 56 | 57 | - (void)dismissAction:(id)sender 58 | { 59 | if (self.delegate && [self.delegate respondsToSelector:@selector(dismissPopView:)]) 60 | { 61 | [self.delegate dismissPopView:self]; 62 | } 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/Pods-CSPopKit_Example-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## CSPopKit 5 | 6 | Copyright (c) 2018 joy_yu <289067005@qq.com> 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 | ## Masonry 28 | 29 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 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 | Generated by CocoaPods - https://cocoapods.org 49 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopReformer.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopReformer.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopReformer.h" 10 | #import "CSCustomPopControllerLoader.h" 11 | #import "CSCustomPopViewLoader.h" 12 | #import "CSCustomPopView.h" 13 | 14 | @implementation CSCustomPopReformer 15 | 16 | - (void)dealloc 17 | { 18 | NSLog(@"popReformer dealloc"); 19 | } 20 | 21 | + (instancetype)reformer 22 | { 23 | return [[self alloc] init]; 24 | } 25 | 26 | - (CSCustomPopView*)fetchPopViewWithData:(id)data viewLoader:(id)viewLoader 27 | { 28 | idpopViewLoader = nil; 29 | if (viewLoader == nil) 30 | { 31 | popViewLoader = [CSCustomPopViewLoader loader]; 32 | } 33 | else 34 | { 35 | popViewLoader = viewLoader; 36 | } 37 | 38 | CSCustomPopView *popView = nil; 39 | if ([popViewLoader respondsToSelector:@selector(view)] && [popViewLoader respondsToSelector:@selector(viewWithData:)]) 40 | { 41 | NSLog(@"not need implemention view and viewWithData: method,implemention either"); 42 | } 43 | if ([popViewLoader respondsToSelector:@selector(viewWithData:)]) 44 | { 45 | popView = [popViewLoader viewWithData:data]; 46 | [popView setData:data]; 47 | return popView; 48 | } 49 | if ([popViewLoader respondsToSelector:@selector(view)]) 50 | { 51 | popView = [popViewLoader view]; 52 | [popView setData:data]; 53 | return popView; 54 | } 55 | NSLog(@"popView is nil,not implementation view or viewWithData: protocol method"); 56 | return popView; 57 | } 58 | 59 | - (id)fetchPopControllerWithData:(id)data popControllerLoader:(id)popControllerLoader view:(CSCustomPopView *)popView 60 | { 61 | id popLoader = nil; 62 | if (popControllerLoader == nil) 63 | { 64 | popLoader = [CSCustomPopControllerLoader loader]; 65 | } 66 | else 67 | { 68 | popLoader = popControllerLoader; 69 | } 70 | 71 | if ([popLoader respondsToSelector:@selector(setContent:)] && [popLoader respondsToSelector:@selector(setContent:data:)]) 72 | { 73 | NSLog(@"not need implemention setContent: and setContent:data: method,implemention either"); 74 | } 75 | 76 | if ([popLoader respondsToSelector:@selector(setContent:data:)]) 77 | { 78 | [popLoader setContent:popView data:data]; 79 | return popLoader; 80 | } 81 | if ([popLoader respondsToSelector:@selector(setContent:)]) 82 | { 83 | [popLoader setContent:popView]; 84 | return popLoader; 85 | } 86 | NSLog(@"popLoader is nil,not implementation setContent:data: or setContent: protocol method"); 87 | return popLoader; 88 | } 89 | @end 90 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/NSArray+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASAdditions.h 3 | // 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | typedef NS_ENUM(NSUInteger, MASAxisType) { 14 | MASAxisTypeHorizontal, 15 | MASAxisTypeVertical 16 | }; 17 | 18 | @interface NSArray (MASAdditions) 19 | 20 | /** 21 | * Creates a MASConstraintMaker with each view in the callee. 22 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing on each view 23 | * 24 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 25 | * 26 | * @return Array of created MASConstraints 27 | */ 28 | - (NSArray *)mas_makeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 29 | 30 | /** 31 | * Creates a MASConstraintMaker with each view in the callee. 32 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 33 | * If an existing constraint exists then it will be updated instead. 34 | * 35 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 36 | * 37 | * @return Array of created/updated MASConstraints 38 | */ 39 | - (NSArray *)mas_updateConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 40 | 41 | /** 42 | * Creates a MASConstraintMaker with each view in the callee. 43 | * Any constraints defined are added to each view or the appropriate superview once the block has finished executing on each view. 44 | * All constraints previously installed for the views will be removed. 45 | * 46 | * @param block scope within which you can build up the constraints which you wish to apply to each view. 47 | * 48 | * @return Array of created/updated MASConstraints 49 | */ 50 | - (NSArray *)mas_remakeConstraints:(void (NS_NOESCAPE ^)(MASConstraintMaker *make))block; 51 | 52 | /** 53 | * distribute with fixed spacing 54 | * 55 | * @param axisType which axis to distribute items along 56 | * @param fixedSpacing the spacing between each item 57 | * @param leadSpacing the spacing before the first item and the container 58 | * @param tailSpacing the spacing after the last item and the container 59 | */ 60 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 61 | 62 | /** 63 | * distribute with fixed item size 64 | * 65 | * @param axisType which axis to distribute items along 66 | * @param fixedItemLength the fixed length of each item 67 | * @param leadSpacing the spacing before the first item and the container 68 | * @param tailSpacing the spacing after the last item and the container 69 | */ 70 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopHeader.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #ifndef CSCustomPopHeader_h 10 | #define CSCustomPopHeader_h 11 | 12 | #import 13 | 14 | @class CSCustomPopModel; 15 | @class CSCustomPopController; 16 | @class CSCustomPopView; 17 | @protocol CSCustomPopHandlerDelegate; 18 | @protocol CSPopControllerProviderProtocol; 19 | @protocol CSCustomReformerProtocol; 20 | @protocol CSPopPriorityProtocol; 21 | 22 | /** 23 | popController protocol: 24 | */ 25 | @protocol CSCustomPopControllerLoaderProtocol 26 | 27 | @optional 28 | + (instancetype)loader; 29 | 30 | - (void)setContent:(UIView *)view; 31 | 32 | - (void)setContent:(UIView *)view data:(id)data; 33 | 34 | @end 35 | 36 | 37 | 38 | /** 39 | popViewLoader protocol: 40 | */ 41 | @protocol CSCustomPopViewLoaderProtocol 42 | 43 | @optional 44 | + (instancetype)loader; 45 | 46 | - (CSCustomPopView *)view; 47 | 48 | - (CSCustomPopView *)viewWithData:(id)data; 49 | 50 | @end 51 | 52 | 53 | /** 54 | handler protocol: 55 | */ 56 | @protocol CSCustomPopHandlerProtocol 57 | 58 | @optional 59 | + (instancetype)handler; 60 | 61 | + (instancetype)handlerWithData:(id)data; 62 | 63 | - (BOOL)shouldShow; 64 | 65 | - (void)markShow:(BOOL)show; 66 | 67 | - (void)willPresentPopView; 68 | 69 | - (void)didPresentPopView; 70 | 71 | - (void)cancelPresentPopView; 72 | 73 | @required 74 | @property (nonatomic,strong) id data; 75 | 76 | @property (nonatomic, strong) void (^completeBlock)(id); 77 | 78 | @property (nonatomic, weak) UIViewController *fromViewController; 79 | 80 | @property (nonatomic, strong) id popController; 81 | 82 | @property (nonatomic,strong) idreformer; 83 | 84 | @property (nonatomic,weak) iddelegate; 85 | 86 | @property (nonatomic, strong) CSCustomPopView *popView; 87 | 88 | @end 89 | 90 | 91 | /** 92 | handler delegate 93 | */ 94 | @protocol CSCustomPopHandlerDelegate 95 | 96 | @required 97 | - (void)removeHandler:(id)handler; 98 | 99 | @end 100 | 101 | 102 | 103 | /** 104 | reformerProtocol 105 | */ 106 | @protocol CSCustomReformerProtocol 107 | 108 | @optional 109 | + (instancetype)reformer; 110 | 111 | - (CSCustomPopView*)fetchPopViewWithData:(id)data viewLoader:(id)viewLoader; 112 | 113 | - (id)fetchPopControllerWithData:(id)data popControllerLoader:(id)popControllerLoader view:(CSCustomPopView *)popView; 114 | @end 115 | 116 | 117 | 118 | /** 119 | popview 关闭代理protocol 120 | */ 121 | @protocol CSCustomPopViewProrocol 122 | 123 | @optional 124 | - (void)dismissPopView:(CSCustomPopView *)popView; 125 | 126 | @end 127 | 128 | 129 | #endif /* CSCustomPopHeader_h */ 130 | -------------------------------------------------------------------------------- /Example/CSPopKit/PopTest/CSCustomPopManagerTest.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopManagerTest.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopManagerTest.h" 10 | #import "CSCustomTestViewLoader.h" 11 | #import "CSCustomTestPopLoader.h" 12 | #import "CSCustomPopHandler.h" 13 | #import "CSCustomPopLowProprityHandler.h" 14 | #import "CSCustomPopHighProprityHandler.h" 15 | #import "CSCustomPopManager.h" 16 | 17 | @implementation CSCustomPopManagerTest 18 | 19 | /** 20 | 测试单个弹窗弹出效果 21 | */ 22 | + (void)testPopView 23 | { 24 | CSCustomPopHighProprityHandler *handler = [CSCustomPopHighProprityHandler handler]; 25 | CSCustomTestViewLoader *viewloader = [CSCustomTestViewLoader loader]; 26 | CSCustomTestPopLoader *popLoader = [CSCustomTestPopLoader loader]; 27 | 28 | [[CSCustomPopManager shareManager] showPopViewWithHandler:handler viewLoader:viewloader popControllerLoader:popLoader completeBlock:^(id data) { 29 | 30 | } fromViewController:nil]; 31 | } 32 | 33 | 34 | /** 35 | 测试单个弹窗错误调用两次 36 | */ 37 | + (void)testRepeatPop 38 | { 39 | [self testPopView]; 40 | [self testPopView]; 41 | } 42 | 43 | 44 | /** 45 | 测试多个优先级的弹窗弹出效果 46 | */ 47 | + (void)testMultiplePop 48 | { 49 | CSCustomPopHandler *handler = [CSCustomPopHandler handler]; 50 | CSCustomPopHighProprityHandler *highPriorityHandler = [CSCustomPopHighProprityHandler handler]; 51 | CSCustomPopLowProprityHandler *lowPriorityHandler = [CSCustomPopLowProprityHandler handler]; 52 | CSCustomTestViewLoader *viewloader = [CSCustomTestViewLoader loader]; 53 | CSCustomTestPopLoader *popLoader = [CSCustomTestPopLoader loader]; 54 | 55 | NSMutableArray *handlers = [NSMutableArray arrayWithArray:@ [handler,lowPriorityHandler,highPriorityHandler]]; 56 | 57 | CSCustomPopHandler *showHandler = handlers[arc4random_uniform((uint32_t)handlers.count)]; 58 | [handlers removeObject:showHandler]; 59 | [self showPopWithHandler:showHandler viewLoader:viewloader popLoader:popLoader]; 60 | 61 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 62 | 63 | CSCustomPopHandler *showHandler = handlers[arc4random_uniform((uint32_t)handlers.count)]; 64 | [handlers removeObject:showHandler]; 65 | [self showPopWithHandler:showHandler viewLoader:viewloader popLoader:popLoader]; 66 | }); 67 | 68 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 69 | 70 | CSCustomPopHandler *showHandler = handlers[arc4random_uniform((uint32_t)handlers.count)]; 71 | [handlers removeObject:showHandler]; 72 | [self showPopWithHandler:showHandler viewLoader:viewloader popLoader:popLoader]; 73 | }); 74 | } 75 | 76 | + (void)showPopWithHandler:(CSCustomPopHandler *)handler viewLoader:(CSCustomPopViewLoader *)viewLoader popLoader:(CSCustomPopControllerLoader *)popLoader 77 | { 78 | [[CSCustomPopManager shareManager] showPopViewWithHandler:handler viewLoader:viewLoader popControllerLoader:popLoader completeBlock:^(id data) { 79 | 80 | } fromViewController:nil]; 81 | } 82 | 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopHandler.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopHandler.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopHandler.h" 10 | #import "CSPopViewManager.h" 11 | #import "CSPopViewPriority.h" 12 | 13 | @implementation CSCustomPopHandler 14 | 15 | @synthesize data = _data; 16 | 17 | @synthesize completeBlock = _completeBlock; 18 | 19 | @synthesize fromViewController = _fromViewController; 20 | 21 | @synthesize popController = _popController; 22 | 23 | @synthesize reformer = _reformer; 24 | 25 | @synthesize delegate = _delegate; 26 | 27 | @synthesize popView = _popView; 28 | 29 | - (void)dealloc 30 | { 31 | NSLog(@"popHandler dealloc"); 32 | } 33 | 34 | 35 | #pragma mark --CSCustomPopHandlerProtocol 36 | 37 | 38 | /** 39 |  初始化方法 40 | 41 | @return <#return value description#> 42 | */ 43 | + (instancetype)handler 44 | { 45 | CSCustomPopHandler *handler = [[self alloc] init]; 46 | /* 47 | do sth with Model 48 | id data = [CSCustomPopModel new]; 49 | handler.data = data; 50 | */ 51 | return handler; 52 | } 53 | 54 | /** 55 |  初始化方法:该方法和上面方法按业务需要实现其一 56 | 57 | @return <#return value description#> 58 | */ 59 | + (instancetype)handlerWithData:(id)data 60 | { 61 | CSCustomPopHandler *handler = [[self alloc] init]; 62 | handler.data = data; 63 | return handler; 64 | } 65 | 66 | 67 | /** 68 |  是否要展示该业务弹窗 69 | 70 | @return yes or no 71 | */ 72 | - (BOOL)shouldShow 73 | { 74 | return YES; 75 | } 76 | 77 | /** 78 |  标记该业务弹窗是否需要展示 79 | 80 | @return yes or no 81 | */ 82 | - (void)markShow:(BOOL)show 83 | { 84 | 85 | } 86 | 87 | 88 | /** 89 | 该业务弹窗将要展示回调: 调用了show方法,即有该回调 90 | */ 91 | - (void)willPresentPopView 92 | { 93 | 94 | } 95 | 96 | /** 97 | 该业务弹窗根据优先级判断了,可以展示在界面上回调 98 | */ 99 | - (void)didPresentPopView 100 | { 101 | 102 | } 103 | 104 | /** 105 | 该业务弹窗根据优先级判断了,不需要展示,被取消展示了回调 106 | */ 107 | - (void)cancelPresentPopView 108 | { 109 | 110 | } 111 | 112 | #pragma mark --CSCustomPopViewProrocol 113 | /** 114 | 默认实现:可完成handler内所有属性的内存释放,以及优先级逻辑,外界继承可覆盖,也可super调用再实现相应业务逻辑 115 | 116 | @param popView 117 | */ 118 | - (void)dismissPopView:(CSCustomPopView *)popView 119 | { 120 | [[CSPopViewManager sharedManager] removePop:self]; 121 | [self.popController dismissPopControllerAnimated:YES]; 122 | self.reformer = nil; 123 | self.popView = nil; 124 | self.popController = nil; 125 | self.completeBlock = nil; 126 | self.fromViewController = nil; 127 | //remove self from manager handlers array 128 | if (self.delegate && [self.delegate respondsToSelector:@selector(removeHandler:)]) 129 | { 130 | [self.delegate removeHandler:self]; 131 | } 132 | } 133 | 134 | #pragma mark --CSPopPriorityProtocol 135 | /** 136 | 优先级delegate:数字 137 | 138 | @return 数字,默认KDefalutPopProprity 139 | */ 140 | - (NSInteger)priority 141 | { 142 | return KDefalutPopProprity; 143 | } 144 | 145 | 146 | /** 147 | 优先级delegate:dismiss popview 148 | */ 149 | - (void)dismissPopView 150 | { 151 | [self dismissPopView:nil]; 152 | } 153 | 154 | @end 155 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/CSPopManager/CSPopViewManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopViewManager.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/5. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSPopViewManager.h" 10 | 11 | @interface CSPopViewManager() 12 | 13 | @property (nonatomic,strong) NSMutableArray *pops; 14 | 15 | @property (nonatomic,weak) id currentPop; 16 | 17 | @end 18 | 19 | @implementation CSPopViewManager 20 | 21 | static CSPopViewManager *_sharedManager; 22 | + (CSPopViewManager *)sharedManager 23 | { 24 | static dispatch_once_t onceToken; 25 | 26 | dispatch_once(&onceToken, ^ 27 | { 28 | _sharedManager = [[self alloc] init]; 29 | _sharedManager.pops = [NSMutableArray array]; 30 | }); 31 | return _sharedManager; 32 | } 33 | 34 | /** 35 | 36 | 当前展示的弹窗present时统一调用该方法,将该弹窗加入弹窗管理中:优先级低,不加入;优先级高,加入 37 | 38 | @param pop 每个弹窗业务对应的相应的pop 39 | @return 当前弹窗是否可展示:优先级低,不展示;优先级高,不展示,需要相应的弹窗业务自己处理该值 40 | */ 41 | - (BOOL)addPop:(id)pop 42 | { 43 | self.currentPop = pop; 44 | __block BOOL cancelCurrentPop = NO; 45 | if (self.pops.count) 46 | { 47 | NSLog(@"the window has pop present"); 48 | } 49 | else 50 | { 51 | NSLog(@"the window has no pop present,so present"); 52 | } 53 | if (pop) 54 | { 55 | [self.pops enumerateObjectsUsingBlock:^(id popPriority, NSUInteger idx, BOOL * _Nonnull stop) { 56 | 57 | if ([NSStringFromClass(popPriority.class) isEqualToString:NSStringFromClass(pop.class)]) 58 | { 59 | NSLog(@"try to present the same pop already present"); 60 | cancelCurrentPop = YES; 61 | } 62 | else 63 | { 64 | if (pop.priority > popPriority.priority) 65 | { 66 | NSLog(@"the pop will present has higher priority,so dismiss current pop"); 67 | if ([popPriority respondsToSelector:@selector(dismissPopView)]) 68 | { 69 | [popPriority dismissPopView]; 70 | } 71 | else 72 | { 73 | NSLog(@"reformer not implemetion the protocol method,cannot be dismiss"); 74 | } 75 | } 76 | else 77 | { 78 | NSLog(@"the pop will present has lower priority,so don't pop"); 79 | cancelCurrentPop = YES; 80 | } 81 | } 82 | }]; 83 | 84 | if (!cancelCurrentPop) 85 | { 86 | [self.pops addObject:pop]; 87 | } 88 | } 89 | else 90 | { 91 | NSLog(@"reformer is nil"); 92 | } 93 | return cancelCurrentPop; 94 | } 95 | 96 | 97 | /** 98 | 当前展示的弹窗dismiss时统一调用该方法,将该弹窗从弹窗管理中移除 99 | 100 | @param pop 每个弹窗业务对应的相应的pop 101 | */ 102 | - (void)removePop:(id)pop 103 | { 104 | [self.pops removeObject:pop]; 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/Pods-CSPopKit_Example-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) 2018 joy_yu <289067005@qq.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 | CSPopKit 41 | Type 42 | PSGroupSpecifier 43 | 44 | 45 | FooterText 46 | Copyright (c) 2011-2012 Masonry Team - https://github.com/Masonry 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 | License 66 | MIT 67 | Title 68 | Masonry 69 | Type 70 | PSGroupSpecifier 71 | 72 | 73 | FooterText 74 | Generated by CocoaPods - https://cocoapods.org 75 | Title 76 | 77 | Type 78 | PSGroupSpecifier 79 | 80 | 81 | StringsTable 82 | Acknowledgements 83 | Title 84 | Acknowledgements 85 | 86 | 87 | -------------------------------------------------------------------------------- /Example/CSPopKit.xcodeproj/xcshareddata/xcschemes/CSPopKit-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 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopManager.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "CSCustomPopHeader.h" 12 | 13 | /* 14 | 1. CSCustomPopManager组件的中心处理类: 15 | 外界传入handler,popViewLoader,popControllerLoader,popReformer等组件,各组件按照各自协议约定实现方法, 16 | manager对这些组件进行相应方法调用,逻辑处理model,view,popContontroller,并present到界面上 17 | 18 | 2.外部未传入的组件,因内部默认逻辑需要,内部会引用该类组件的默认实现类: 19 | 如handler对应的CSCustomPopHandler 20 | popControllerLoader对应的CSCustomPopControllerLoader 21 | popReformer对应的CSCustomPopReformer 22 | viewloader对应的CSCustomPopViewLoader 23 | 24 | 3.整个弹窗模块为最基本实现(范式实现),其他业务使用可直接调用CSCustomPopManager作为外部暴露方法, 25 | 真正业务其余组件使用可用两种方法 26 | 1.不用对各协议完全实现,可直接使用对应的组件基类即可,如CSCustomPopHandler,CSCustomPopControllerLoader,popReformer 27 | ,CSCustomPopViewLoader,使用基类可达到默认实现协议方法的好处。 28 | 29 | 2.不使用基类,完全按照协议自定义实现 30 | */ 31 | 32 | 33 | 34 | @interface CSCustomPopManager : NSObject 35 | 36 | + (instancetype)shareManager; 37 | 38 | /** 39 | 40 | 提供handler,popViewLoader,popControllerLoader三种组件在外部组装 41 | 内部封装处理了一个默认reformer提供view,model的绑定更新(提供popControllerLoader的样式) 42 | 43 | @param handler 单个业务的handler,在里面处理如下业务:是否展示弹窗,不再展示弹窗,弹窗willShow,didShow,弹窗销毁,弹窗引起的购买等等附加业务。。。。 44 | @param popViewLoader 提供该业务所需要的view 45 | @param popControllerLoader 提供该业务view所需要的pop样式 46 | @param completeBlock completeBlock 47 | @param viewController viewController 48 | 49 | handler传nil,内部默认CSCustomPopHandler组件处理 50 | popViewLoader传nil,内部默认CSCustomPopViewLoader组件处理 51 | popControllerLoader传nil,内部默认CSCustomPopControllerLoader组件处理 52 | 53 | */ 54 | - (void)showPopViewWithHandler:(id)handler 55 | viewLoader:(id)popViewLoader 56 | popControllerLoader:(id)popControllerLoader 57 | completeBlock:(void (^)(id data))completeBlock 58 | fromViewController:(UIViewController *)viewController; 59 | 60 | 61 | /** 62 | 提供handler,popViewLoader,popReformer三种组件在外部组装 63 | 外部传入的reformer提供view,model的绑定更新,提供popControllerLoader的个性化样式 64 | 65 | @param handler 单个业务的handler,在里面处理如下业务:是否展示弹窗,不再展示弹窗,弹窗willShow,didShow,弹窗销毁,弹窗引起的购买等等附加业务。。。。 66 | @param popViewLoader 提供该业务所需要的view 67 | @param popReformer 提供view,model的数据绑定,在popController外部组件为空时内部定制view的pop样式,一般业务时比较轻量,当同一业务可能需要多种view展示时,在reformer中可按照具体逻辑处理(如高级账号弹窗,根据model类型,展示点券高级账号购买,点券购买,高级账号购买,点券使用等不同弹窗view) 68 | @param completeBlock completeBlock 69 | @param viewController viewController 70 | 71 | 72 | handler传nil,内部默认CSCustomPopHandler组件处理 73 | popViewLoader传nil,内部默认CSCustomPopViewLoader组件处理 74 | popReformer传nil,内部默认CSCustomPopReformer组件处理 75 | */ 76 | - (void)showPopViewWithHandler:(id)handler 77 | viewLoader:(id)popViewLoader 78 | popReformer:(id)popReformer 79 | completeBlock:(void (^)(id data))completeBlock 80 | fromViewController:(UIViewController *)viewController; 81 | 82 | 83 | 84 | /** 85 | 最底层方法:提供所有组件的拼装,一般没必要调用:handler,popViewLoader,popControllerLoader,popReformer四种组件在外部组装 86 | 87 | @param popHandler 单个业务的handler,在里面处理如下业务:是否展示弹窗,不再展示弹窗,弹窗willShow,didShow,弹窗销毁,弹窗引起的购买等等附加业务。。。。 88 | @param popViewLoader 提供该业务所需要的view 89 | @param popControllerLoader 提供该业务view所需要的pop样式 90 | @param popReformer 提供view,model的数据绑定,在popController外部组件为空时内部定制view的pop样式,一般业务时比较轻量,当同一业务可能需要多种view展示时,在reformer中可按照具体逻辑处理(如高级账号弹窗,根据model类型,展示点券高级账号购买,点券购买,高级账号购买,点券使用等不同弹窗view) 91 | @param completeBlock completeBlock 92 | @param viewController viewController 93 | */ 94 | - (void)showPopViewWithHandler:(id)popHandler 95 | viewLoader:(id)popViewLoader 96 | popControllerLoader:(id)popControllerLoader 97 | popReformer:(id)popReformer 98 | completeBlock:(void (^)(id data))completeBlock 99 | fromViewController:(UIViewController *)viewController; 100 | 101 | @end 102 | 103 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSPopController/CSPopTheme.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopTheme.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/4. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSPopTheme.h" 10 | 11 | @implementation CSPopTheme 12 | 13 | + (instancetype)defaultTheme 14 | { 15 | CSPopTheme *defaultTheme = [[CSPopTheme alloc] init]; 16 | defaultTheme.maskTypeTheme(CSPopThemeMaskTypeDimmed).cornerRadiusTheme(16.0f).maxPopupWidthTheme(300.0f).animationPresentionDurationTheme(0.3f).animationDismissDurationTheme(0.3f).shouldDismissOnBackgroundTouchTheme(NO).popThemePresentationStyleTheme(CSPPopThemePresentationStyleFadeIn).popThemeDismissStyleTheme(CSPPopThemeDismissStyleFadeOut).horizontalOffsetTheme(0.f).verticalOffsetTheme(0.f); 17 | return defaultTheme; 18 | } 19 | 20 | + (instancetype)defaultGuideTheme 21 | { 22 | CSPopTheme *defaultTheme = [[CSPopTheme alloc] init]; 23 | defaultTheme.maskTypeTheme(CSPopThemeMaskTypeDimmed).cornerRadiusTheme(16.0f).maxPopupWidthTheme(300.0f).animationPresentionDurationTheme(0.8f).animationDismissDurationTheme(0.45f).shouldDismissOnBackgroundTouchTheme(NO).popThemePresentationStyleTheme(CSPPopThemePresentationStyleSlideInFromTop).popThemeDismissStyleTheme(CSPPopThemeDismissStyleSlideInToBottom).horizontalOffsetTheme(0.f).verticalOffsetTheme(0.f); 24 | return defaultTheme; 25 | } 26 | 27 | //- (CSPopTheme *(^)(UIColor *))backgroundColorTheme 28 | //{ 29 | // return ^CSPopTheme *(UIColor * color) 30 | // { 31 | // self.backgroundColor = color; 32 | // return self; 33 | // }; 34 | //} 35 | 36 | - (CSPopTheme *(^)(CGFloat))cornerRadiusTheme 37 | { 38 | return ^CSPopTheme *(CGFloat cornerRadius) 39 | { 40 | self.cornerRadius = cornerRadius; 41 | return self; 42 | }; 43 | } 44 | 45 | - (CSPopTheme *(^)(CSPPopThemeStyle))popThemePresentationStyleTheme 46 | { 47 | return ^CSPopTheme *(CSPPopThemeStyle popThemePresentationStyle) 48 | { 49 | self.presentationStyle = popThemePresentationStyle; 50 | return self; 51 | }; 52 | } 53 | 54 | - (CSPopTheme *(^)(CSPPopThemeStyle))popThemeDismissStyleTheme 55 | { 56 | return ^CSPopTheme *(CSPPopThemeStyle popThemeDismissStyleTheme) 57 | { 58 | self.dismissStyle = popThemeDismissStyleTheme; 59 | return self; 60 | }; 61 | } 62 | - (CSPopTheme *(^)(CSPopThemeLocationType))popThemeLocationTheme 63 | { 64 | return ^CSPopTheme *(CSPopThemeLocationType popThemeLocationTheme) 65 | { 66 | self.locationType = popThemeLocationTheme; 67 | return self; 68 | }; 69 | } 70 | 71 | - (CSPopTheme *(^)(CGPoint))dismissPointTheme 72 | { 73 | return ^CSPopTheme *(CGPoint dismissPoint) 74 | { 75 | self.dismissPoint = dismissPoint; 76 | return self; 77 | }; 78 | } 79 | 80 | - (CSPopTheme *(^)(CSPopThemeMaskType))maskTypeTheme 81 | { 82 | return ^CSPopTheme *(CSPopThemeMaskType maskType) 83 | { 84 | self.maskType = maskType; 85 | return self; 86 | }; 87 | } 88 | 89 | - (CSPopTheme *(^)(BOOL))shouldDismissOnBackgroundTouchTheme 90 | { 91 | return ^CSPopTheme *(BOOL shouldDismissOnBackgroundTouch) 92 | { 93 | self.shouldDismissOnBackgroundTouch = shouldDismissOnBackgroundTouch; 94 | return self; 95 | }; 96 | } 97 | 98 | - (CSPopTheme *(^)(CGFloat))maxPopupWidthTheme 99 | { 100 | return ^CSPopTheme *(CGFloat maxPopupWidth) 101 | { 102 | self.maxPopupWidth = maxPopupWidth; 103 | return self; 104 | }; 105 | } 106 | 107 | - (CSPopTheme *(^)(BOOL))flexPopupWidthTheme 108 | { 109 | return ^CSPopTheme *(BOOL flexPopupWidth) 110 | { 111 | self.flexPopupWidth = flexPopupWidth; 112 | return self; 113 | }; 114 | } 115 | 116 | - (CSPopTheme *(^)(CGFloat))animationPresentionDurationTheme 117 | { 118 | return ^CSPopTheme *(CGFloat animationPresentionDuration) 119 | { 120 | self.animationPresentionDuration = animationPresentionDuration; 121 | return self; 122 | }; 123 | } 124 | 125 | - (CSPopTheme *(^)(CGFloat))animationDismissDurationTheme 126 | { 127 | return ^CSPopTheme *(CGFloat animationDismissDuration) 128 | { 129 | self.animationDismissDuration = animationDismissDuration; 130 | return self; 131 | }; 132 | } 133 | 134 | - (CSPopTheme *(^)(CGFloat))verticalOffsetTheme 135 | { 136 | return ^CSPopTheme *(CGFloat verticalOffset) 137 | { 138 | self.verticalOffset = verticalOffset; 139 | return self; 140 | }; 141 | } 142 | 143 | - (CSPopTheme *(^)(CGFloat))horizontalOffsetTheme 144 | { 145 | return ^CSPopTheme *(CGFloat horizontalOffset) 146 | { 147 | self.horizontalOffset = horizontalOffset; 148 | return self; 149 | }; 150 | } 151 | 152 | @end 153 | 154 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSPopController/CSPopTheme.h: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopTheme.h 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/4. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | /** 13 | 弹窗的遮罩模式 14 | 15 | - CSPopThemeMaskTypeClear: 透明 16 | - CSPopThemeMaskTypeDimmed: 带灰色 17 | */ 18 | typedef NS_ENUM(NSInteger, CSPopThemeMaskType) 19 | { 20 | CSPopThemeMaskTypeClear, 21 | CSPopThemeMaskTypeDimmed 22 | }; 23 | 24 | 25 | 26 | /** 27 | 弹出,消失动画类型 28 | - CSPPopThemePresentationStyleNone:<#CSPPopThemePresentationStyleFadeIn description#> 29 | - CSPPopThemePresentationStyleFadeIn: <#CSPPopThemePresentationStyleFadeIn description#> 30 | - CSPPopThemePresentationStyleSlideInFromTop: <#CSPPopThemePresentationStyleSlideInFromTop description#> 31 | - CSPPopThemePresentationStyleSlideInFromTopAndAngleBounce: <#CSPPopThemePresentationStyleSlideInFromTopAndAngleBounce description#> 32 | - CSPPopThemePresentationStyleSlideInFromBottom: <#CSPPopThemePresentationStyleSlideInFromBottom description#> 33 | - CSPPopThemePresentationStyleSlideInFromLeft: <#CSPPopThemePresentationStyleSlideInFromLeft description#> 34 | - CSPPopThemePresentationStyleSlideInFromRight: <#CSPPopThemePresentationStyleSlideInFromRight description#> 35 | - CSPPopThemeDismissStyleFadeOut: <#CSPPopThemeDismissStyleFadeOut description#> 36 | - CSPPopThemeDismissStyleSlideInToTop: <#CSPPopThemeDismissStyleSlideInToTop description#> 37 | - CSPPopThemeDismissStyleSlideInToBottom: <#CSPPopThemeDismissStyleSlideInToBottom description#> 38 | - CSPPopThemeDismissStyleSlideInToBottomAndAngle: <#CSPPopThemeDismissStyleSlideInToBottomAndAngle description#> 39 | - CSPPopThemeDismissStyleSlideInToLeft: <#CSPPopThemeDismissStyleSlideInToLeft description#> 40 | - CSPPopThemeDismissStyleSlideInToRight: <#CSPPopThemeDismissStyleSlideInToRight description#> 41 | */ 42 | typedef NS_ENUM(NSInteger, CSPPopThemeStyle) 43 | { 44 | CSPPopThemePresentationStyleNone, 45 | CSPPopThemePresentationStyleFadeIn, 46 | CSPPopThemePresentationStyleSlideInFromTop, 47 | CSPPopThemePresentationStyleSlideInFromTopAndAngleBounce, 48 | CSPPopThemePresentationStyleSlideInFromBottom, 49 | CSPPopThemePresentationStyleSlideInFromLeft, 50 | CSPPopThemePresentationStyleSlideInFromRight, 51 | 52 | CSPPopThemeDismissStyleNone, 53 | CSPPopThemeDismissStyleFadeOut, 54 | CSPPopThemeDismissStyleSlideInToTop, 55 | CSPPopThemeDismissStyleSlideInToBottom, 56 | CSPPopThemeDismissStyleSlideInToBottomAndAngle, 57 | CSPPopThemeDismissStyleSlideInToPointAndScale, 58 | CSPPopThemeDismissStyleSlideInToLeft, 59 | CSPPopThemeDismissStyleSlideInToRight 60 | }; 61 | 62 | typedef NS_ENUM(NSUInteger, CSPopThemeLocationType) { 63 | CSPopThemeLocationDefaultCenter, // 默认是居中 64 | CSPopThemeLocationBottom // 底部 65 | }; 66 | 67 | @interface CSPopTheme : NSObject 68 | 69 | //@property (nonatomic, strong) UIColor *backgroundColor; 70 | @property (nonatomic, assign) CGFloat cornerRadius; 71 | @property (nonatomic, assign) CSPPopThemeStyle presentationStyle; 72 | @property (nonatomic, assign) CSPPopThemeStyle dismissStyle; 73 | @property (nonatomic, assign) CSPopThemeMaskType maskType; 74 | @property (nonatomic, assign) CSPopThemeLocationType locationType; 75 | @property (nonatomic, assign) BOOL shouldDismissOnBackgroundTouch; 76 | @property (nonatomic, assign) CGFloat maxPopupWidth; 77 | //弹性宽度 78 | @property (nonatomic, assign) BOOL flexPopupWidth; 79 | @property (nonatomic, assign) CGFloat animationPresentionDuration; 80 | @property (nonatomic, assign) CGFloat animationDismissDuration; 81 | @property (nonatomic, assign) CGFloat verticalOffset; 82 | @property (nonatomic, assign) CGFloat horizontalOffset; 83 | @property (nonatomic, assign) CGPoint dismissPoint; 84 | 85 | //链式赋值属性 86 | //@property (nonatomic, copy) CSPopTheme *(^backgroundColorTheme)(UIColor *); 87 | @property (nonatomic, copy) CSPopTheme *(^cornerRadiusTheme)(CGFloat); 88 | @property (nonatomic, copy) CSPopTheme *(^popThemePresentationStyleTheme)(CSPPopThemeStyle); 89 | @property (nonatomic, copy) CSPopTheme *(^popThemeDismissStyleTheme)(CSPPopThemeStyle); 90 | @property (nonatomic, copy) CSPopTheme *(^popThemeLocationTheme)(CSPopThemeLocationType); 91 | @property (nonatomic, copy) CSPopTheme *(^maskTypeTheme)(CSPopThemeMaskType); 92 | @property (nonatomic, copy) CSPopTheme *(^shouldDismissOnBackgroundTouchTheme)(BOOL); 93 | @property (nonatomic, copy) CSPopTheme *(^maxPopupWidthTheme)(CGFloat); 94 | @property (nonatomic, copy) CSPopTheme *(^flexPopupWidthTheme)(BOOL); 95 | @property (nonatomic, copy) CSPopTheme *(^animationPresentionDurationTheme)(CGFloat); 96 | @property (nonatomic, copy) CSPopTheme *(^animationDismissDurationTheme)(CGFloat); 97 | @property (nonatomic, assign) CSPopTheme *(^verticalOffsetTheme)(CGFloat); 98 | @property (nonatomic, assign) CSPopTheme *(^horizontalOffsetTheme)(CGFloat); 99 | @property (nonatomic, assign) CSPopTheme *(^dismissPointTheme)(CGPoint); 100 | + (instancetype)defaultTheme; 101 | 102 | + (instancetype)defaultGuideTheme; 103 | 104 | @end 105 | 106 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/View+MASAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASUtilities.h" 10 | #import "MASConstraintMaker.h" 11 | #import "MASViewAttribute.h" 12 | 13 | /** 14 | * Provides constraint maker block 15 | * and convience methods for creating MASViewAttribute which are view + NSLayoutAttribute pairs 16 | */ 17 | @interface MAS_VIEW (MASAdditions) 18 | 19 | /** 20 | * following properties return a new MASViewAttribute with current view and appropriate NSLayoutAttribute 21 | */ 22 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_left; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_top; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_right; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottom; 26 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leading; 27 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailing; 28 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_width; 29 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_height; 30 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerX; 31 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerY; 32 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_baseline; 33 | @property (nonatomic, strong, readonly) MASViewAttribute *(^mas_attribute)(NSLayoutAttribute attr); 34 | 35 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 36 | 37 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_firstBaseline; 38 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_lastBaseline; 39 | 40 | #endif 41 | 42 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 43 | 44 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leftMargin; 45 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_rightMargin; 46 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_topMargin; 47 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_bottomMargin; 48 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_leadingMargin; 49 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_trailingMargin; 50 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerXWithinMargins; 51 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_centerYWithinMargins; 52 | 53 | #endif 54 | 55 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) 56 | 57 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuide API_AVAILABLE(ios(11.0),tvos(11.0)); 58 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideTop API_AVAILABLE(ios(11.0),tvos(11.0)); 59 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideBottom API_AVAILABLE(ios(11.0),tvos(11.0)); 60 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideLeft API_AVAILABLE(ios(11.0),tvos(11.0)); 61 | @property (nonatomic, strong, readonly) MASViewAttribute *mas_safeAreaLayoutGuideRight API_AVAILABLE(ios(11.0),tvos(11.0)); 62 | 63 | #endif 64 | 65 | /** 66 | * a key to associate with this view 67 | */ 68 | @property (nonatomic, strong) id mas_key; 69 | 70 | /** 71 | * Finds the closest common superview between this view and another view 72 | * 73 | * @param view other view 74 | * 75 | * @return returns nil if common superview could not be found 76 | */ 77 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view; 78 | 79 | /** 80 | * Creates a MASConstraintMaker with the callee view. 81 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing 82 | * 83 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 84 | * 85 | * @return Array of created MASConstraints 86 | */ 87 | - (NSArray *)mas_makeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block; 88 | 89 | /** 90 | * Creates a MASConstraintMaker with the callee view. 91 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 92 | * If an existing constraint exists then it will be updated instead. 93 | * 94 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 95 | * 96 | * @return Array of created/updated MASConstraints 97 | */ 98 | - (NSArray *)mas_updateConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block; 99 | 100 | /** 101 | * Creates a MASConstraintMaker with the callee view. 102 | * Any constraints defined are added to the view or the appropriate superview once the block has finished executing. 103 | * All constraints previously installed for the view will be removed. 104 | * 105 | * @param block scope within which you can build up the constraints which you wish to apply to the view. 106 | * 107 | * @return Array of created/updated MASConstraints 108 | */ 109 | - (NSArray *)mas_remakeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *make))block; 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /Example/CSPopKit/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 34 | 41 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/View+MASShorthandAdditions.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASShorthandAdditions.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 22/07/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "View+MASAdditions.h" 10 | 11 | #ifdef MAS_SHORTHAND 12 | 13 | /** 14 | * Shorthand view additions without the 'mas_' prefixes, 15 | * only enabled if MAS_SHORTHAND is defined 16 | */ 17 | @interface MAS_VIEW (MASShorthandAdditions) 18 | 19 | @property (nonatomic, strong, readonly) MASViewAttribute *left; 20 | @property (nonatomic, strong, readonly) MASViewAttribute *top; 21 | @property (nonatomic, strong, readonly) MASViewAttribute *right; 22 | @property (nonatomic, strong, readonly) MASViewAttribute *bottom; 23 | @property (nonatomic, strong, readonly) MASViewAttribute *leading; 24 | @property (nonatomic, strong, readonly) MASViewAttribute *trailing; 25 | @property (nonatomic, strong, readonly) MASViewAttribute *width; 26 | @property (nonatomic, strong, readonly) MASViewAttribute *height; 27 | @property (nonatomic, strong, readonly) MASViewAttribute *centerX; 28 | @property (nonatomic, strong, readonly) MASViewAttribute *centerY; 29 | @property (nonatomic, strong, readonly) MASViewAttribute *baseline; 30 | @property (nonatomic, strong, readonly) MASViewAttribute *(^attribute)(NSLayoutAttribute attr); 31 | 32 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 33 | 34 | @property (nonatomic, strong, readonly) MASViewAttribute *firstBaseline; 35 | @property (nonatomic, strong, readonly) MASViewAttribute *lastBaseline; 36 | 37 | #endif 38 | 39 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 40 | 41 | @property (nonatomic, strong, readonly) MASViewAttribute *leftMargin; 42 | @property (nonatomic, strong, readonly) MASViewAttribute *rightMargin; 43 | @property (nonatomic, strong, readonly) MASViewAttribute *topMargin; 44 | @property (nonatomic, strong, readonly) MASViewAttribute *bottomMargin; 45 | @property (nonatomic, strong, readonly) MASViewAttribute *leadingMargin; 46 | @property (nonatomic, strong, readonly) MASViewAttribute *trailingMargin; 47 | @property (nonatomic, strong, readonly) MASViewAttribute *centerXWithinMargins; 48 | @property (nonatomic, strong, readonly) MASViewAttribute *centerYWithinMargins; 49 | 50 | #endif 51 | 52 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) 53 | 54 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideTop API_AVAILABLE(ios(11.0),tvos(11.0)); 55 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideBottom API_AVAILABLE(ios(11.0),tvos(11.0)); 56 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideLeft API_AVAILABLE(ios(11.0),tvos(11.0)); 57 | @property (nonatomic, strong, readonly) MASViewAttribute *safeAreaLayoutGuideRight API_AVAILABLE(ios(11.0),tvos(11.0)); 58 | 59 | #endif 60 | 61 | - (NSArray *)makeConstraints:(void(^)(MASConstraintMaker *make))block; 62 | - (NSArray *)updateConstraints:(void(^)(MASConstraintMaker *make))block; 63 | - (NSArray *)remakeConstraints:(void(^)(MASConstraintMaker *make))block; 64 | 65 | @end 66 | 67 | #define MAS_ATTR_FORWARD(attr) \ 68 | - (MASViewAttribute *)attr { \ 69 | return [self mas_##attr]; \ 70 | } 71 | 72 | @implementation MAS_VIEW (MASShorthandAdditions) 73 | 74 | MAS_ATTR_FORWARD(top); 75 | MAS_ATTR_FORWARD(left); 76 | MAS_ATTR_FORWARD(bottom); 77 | MAS_ATTR_FORWARD(right); 78 | MAS_ATTR_FORWARD(leading); 79 | MAS_ATTR_FORWARD(trailing); 80 | MAS_ATTR_FORWARD(width); 81 | MAS_ATTR_FORWARD(height); 82 | MAS_ATTR_FORWARD(centerX); 83 | MAS_ATTR_FORWARD(centerY); 84 | MAS_ATTR_FORWARD(baseline); 85 | 86 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 87 | 88 | MAS_ATTR_FORWARD(firstBaseline); 89 | MAS_ATTR_FORWARD(lastBaseline); 90 | 91 | #endif 92 | 93 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 94 | 95 | MAS_ATTR_FORWARD(leftMargin); 96 | MAS_ATTR_FORWARD(rightMargin); 97 | MAS_ATTR_FORWARD(topMargin); 98 | MAS_ATTR_FORWARD(bottomMargin); 99 | MAS_ATTR_FORWARD(leadingMargin); 100 | MAS_ATTR_FORWARD(trailingMargin); 101 | MAS_ATTR_FORWARD(centerXWithinMargins); 102 | MAS_ATTR_FORWARD(centerYWithinMargins); 103 | 104 | #endif 105 | 106 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) 107 | 108 | MAS_ATTR_FORWARD(safeAreaLayoutGuideTop); 109 | MAS_ATTR_FORWARD(safeAreaLayoutGuideBottom); 110 | MAS_ATTR_FORWARD(safeAreaLayoutGuideLeft); 111 | MAS_ATTR_FORWARD(safeAreaLayoutGuideRight); 112 | 113 | #endif 114 | 115 | - (MASViewAttribute *(^)(NSLayoutAttribute))attribute { 116 | return [self mas_attribute]; 117 | } 118 | 119 | - (NSArray *)makeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { 120 | return [self mas_makeConstraints:block]; 121 | } 122 | 123 | - (NSArray *)updateConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { 124 | return [self mas_updateConstraints:block]; 125 | } 126 | 127 | - (NSArray *)remakeConstraints:(void(NS_NOESCAPE ^)(MASConstraintMaker *))block { 128 | return [self mas_remakeConstraints:block]; 129 | } 130 | 131 | @end 132 | 133 | #endif 134 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASCompositeConstraint.m: -------------------------------------------------------------------------------- 1 | // 2 | // MASCompositeConstraint.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 21/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASCompositeConstraint.h" 10 | #import "MASConstraint+Private.h" 11 | 12 | @interface MASCompositeConstraint () 13 | 14 | @property (nonatomic, strong) id mas_key; 15 | @property (nonatomic, strong) NSMutableArray *childConstraints; 16 | 17 | @end 18 | 19 | @implementation MASCompositeConstraint 20 | 21 | - (id)initWithChildren:(NSArray *)children { 22 | self = [super init]; 23 | if (!self) return nil; 24 | 25 | _childConstraints = [children mutableCopy]; 26 | for (MASConstraint *constraint in _childConstraints) { 27 | constraint.delegate = self; 28 | } 29 | 30 | return self; 31 | } 32 | 33 | #pragma mark - MASConstraintDelegate 34 | 35 | - (void)constraint:(MASConstraint *)constraint shouldBeReplacedWithConstraint:(MASConstraint *)replacementConstraint { 36 | NSUInteger index = [self.childConstraints indexOfObject:constraint]; 37 | NSAssert(index != NSNotFound, @"Could not find constraint %@", constraint); 38 | [self.childConstraints replaceObjectAtIndex:index withObject:replacementConstraint]; 39 | } 40 | 41 | - (MASConstraint *)constraint:(MASConstraint __unused *)constraint addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 42 | id strongDelegate = self.delegate; 43 | MASConstraint *newConstraint = [strongDelegate constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; 44 | newConstraint.delegate = self; 45 | [self.childConstraints addObject:newConstraint]; 46 | return newConstraint; 47 | } 48 | 49 | #pragma mark - NSLayoutConstraint multiplier proxies 50 | 51 | - (MASConstraint * (^)(CGFloat))multipliedBy { 52 | return ^id(CGFloat multiplier) { 53 | for (MASConstraint *constraint in self.childConstraints) { 54 | constraint.multipliedBy(multiplier); 55 | } 56 | return self; 57 | }; 58 | } 59 | 60 | - (MASConstraint * (^)(CGFloat))dividedBy { 61 | return ^id(CGFloat divider) { 62 | for (MASConstraint *constraint in self.childConstraints) { 63 | constraint.dividedBy(divider); 64 | } 65 | return self; 66 | }; 67 | } 68 | 69 | #pragma mark - MASLayoutPriority proxy 70 | 71 | - (MASConstraint * (^)(MASLayoutPriority))priority { 72 | return ^id(MASLayoutPriority priority) { 73 | for (MASConstraint *constraint in self.childConstraints) { 74 | constraint.priority(priority); 75 | } 76 | return self; 77 | }; 78 | } 79 | 80 | #pragma mark - NSLayoutRelation proxy 81 | 82 | - (MASConstraint * (^)(id, NSLayoutRelation))equalToWithRelation { 83 | return ^id(id attr, NSLayoutRelation relation) { 84 | for (MASConstraint *constraint in self.childConstraints.copy) { 85 | constraint.equalToWithRelation(attr, relation); 86 | } 87 | return self; 88 | }; 89 | } 90 | 91 | #pragma mark - attribute chaining 92 | 93 | - (MASConstraint *)addConstraintWithLayoutAttribute:(NSLayoutAttribute)layoutAttribute { 94 | [self constraint:self addConstraintWithLayoutAttribute:layoutAttribute]; 95 | return self; 96 | } 97 | 98 | #pragma mark - Animator proxy 99 | 100 | #if TARGET_OS_MAC && !(TARGET_OS_IPHONE || TARGET_OS_TV) 101 | 102 | - (MASConstraint *)animator { 103 | for (MASConstraint *constraint in self.childConstraints) { 104 | [constraint animator]; 105 | } 106 | return self; 107 | } 108 | 109 | #endif 110 | 111 | #pragma mark - debug helpers 112 | 113 | - (MASConstraint * (^)(id))key { 114 | return ^id(id key) { 115 | self.mas_key = key; 116 | int i = 0; 117 | for (MASConstraint *constraint in self.childConstraints) { 118 | constraint.key([NSString stringWithFormat:@"%@[%d]", key, i++]); 119 | } 120 | return self; 121 | }; 122 | } 123 | 124 | #pragma mark - NSLayoutConstraint constant setters 125 | 126 | - (void)setInsets:(MASEdgeInsets)insets { 127 | for (MASConstraint *constraint in self.childConstraints) { 128 | constraint.insets = insets; 129 | } 130 | } 131 | 132 | - (void)setInset:(CGFloat)inset { 133 | for (MASConstraint *constraint in self.childConstraints) { 134 | constraint.inset = inset; 135 | } 136 | } 137 | 138 | - (void)setOffset:(CGFloat)offset { 139 | for (MASConstraint *constraint in self.childConstraints) { 140 | constraint.offset = offset; 141 | } 142 | } 143 | 144 | - (void)setSizeOffset:(CGSize)sizeOffset { 145 | for (MASConstraint *constraint in self.childConstraints) { 146 | constraint.sizeOffset = sizeOffset; 147 | } 148 | } 149 | 150 | - (void)setCenterOffset:(CGPoint)centerOffset { 151 | for (MASConstraint *constraint in self.childConstraints) { 152 | constraint.centerOffset = centerOffset; 153 | } 154 | } 155 | 156 | #pragma mark - MASConstraint 157 | 158 | - (void)activate { 159 | for (MASConstraint *constraint in self.childConstraints) { 160 | [constraint activate]; 161 | } 162 | } 163 | 164 | - (void)deactivate { 165 | for (MASConstraint *constraint in self.childConstraints) { 166 | [constraint deactivate]; 167 | } 168 | } 169 | 170 | - (void)install { 171 | for (MASConstraint *constraint in self.childConstraints) { 172 | constraint.updateExisting = self.updateExisting; 173 | [constraint install]; 174 | } 175 | } 176 | 177 | - (void)uninstall { 178 | for (MASConstraint *constraint in self.childConstraints) { 179 | [constraint uninstall]; 180 | } 181 | } 182 | 183 | @end 184 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSCustomPopManage/Basic/CSCustomPopManager.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSCustomPopManager.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/12. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSCustomPopManager.h" 10 | 11 | #import "CSCustomPopManagerPrivate.h" 12 | 13 | @implementation CSCustomPopManager 14 | 15 | static CSCustomPopManager *manager; 16 | + (instancetype)shareManager 17 | { 18 | static dispatch_once_t onceToken; 19 | dispatch_once(&onceToken, ^{ 20 | manager = [[self alloc] init]; 21 | manager.handlers = [NSMutableArray arrayWithCapacity:1]; 22 | }); 23 | return manager; 24 | } 25 | 26 | - (void)showPopViewWithHandler:(id)handler 27 | viewLoader:(id)popViewLoader 28 | popControllerLoader:(id)popControllerLoader 29 | completeBlock:(void (^)(id))completeBlock 30 | fromViewController:(UIViewController *)viewController 31 | { 32 | [self showPopViewWithHandler:handler viewLoader:popViewLoader popControllerLoader:popControllerLoader popReformer:nil completeBlock:completeBlock fromViewController:viewController]; 33 | } 34 | 35 | - (void)showPopViewWithHandler:(id)handler 36 | viewLoader:(id)popViewLoader 37 | popReformer:(id)popReformer 38 | completeBlock:(void (^)(id))completeBlock 39 | fromViewController:(UIViewController *)viewController 40 | { 41 | [self showPopViewWithHandler:handler viewLoader:popViewLoader popControllerLoader:nil popReformer:popReformer completeBlock:completeBlock fromViewController:viewController]; 42 | } 43 | 44 | - (void)showPopViewWithHandler:(id)popHandler 45 | viewLoader:(id)popViewLoader 46 | popControllerLoader:(id)popControllerLoader 47 | popReformer:(id)popReformer 48 | completeBlock:(void (^)(id))completeBlock 49 | fromViewController:(UIViewController *)viewController; 50 | { 51 | NSLog(@"will show popView"); 52 | 53 | id reformer = nil; 54 | CSCustomPopView *popView = nil; 55 | id popController = nil; 56 | id handler = nil; 57 | 58 | //handler组件处理 59 | if (popHandler == nil) 60 | { 61 | handler = [CSCustomPopHandler handler]; 62 | } 63 | else 64 | { 65 | handler = popHandler; 66 | } 67 | handler.delegate = self; 68 | handler.completeBlock = completeBlock; 69 | handler.fromViewController = viewController; 70 | [self.handlers addObject:handler]; 71 | 72 | //reformer组件处理 73 | if (popReformer == nil) 74 | { 75 | reformer = [CSCustomPopReformer reformer]; 76 | } 77 | else 78 | { 79 | reformer = popReformer; 80 | } 81 | handler.reformer = reformer; 82 | 83 | //viewloader组件处理:reformer内部处理viewloader是否为空以及方法调用 84 | if (reformer && [reformer respondsToSelector:@selector(fetchPopViewWithData:viewLoader:)]) 85 | { 86 | popView = [reformer fetchPopViewWithData:handler.data viewLoader:popViewLoader]; 87 | } 88 | else 89 | { 90 | NSLog(@"reformer not implemention fetchPopViewWithModel:viewLoader method"); 91 | } 92 | popView.delegate = handler; 93 | handler.popView = popView; 94 | 95 | if (handler && [handler respondsToSelector:@selector(willPresentPopView)]) 96 | { 97 | [handler willPresentPopView]; 98 | } 99 | else 100 | { 101 | NSLog(@"handler not implemention willPresentPopView menthod"); 102 | } 103 | BOOL cancel = [[CSPopViewManager sharedManager] addPop:handler]; 104 | if (cancel) 105 | { 106 | NSLog(@"cancel pop for popView,priority:%ld",[handler priority]); 107 | if (handler && [handler respondsToSelector:@selector(cancelPresentPopView)]) 108 | { 109 | [handler cancelPresentPopView]; 110 | } 111 | else 112 | { 113 | NSLog(@"handler not implemention cancelPresentPopView menthod"); 114 | } 115 | return; 116 | } 117 | else 118 | { 119 | NSLog(@"popView did show,priority:%ld",[handler priority]); 120 | } 121 | 122 | //popController组件处理:reformer内部处理popController组件是否为空以及方法调用 123 | if (reformer && [reformer respondsToSelector:@selector(fetchPopControllerWithData:popControllerLoader:view:)]) 124 | { 125 | popController = [reformer fetchPopControllerWithData:handler.data popControllerLoader:popControllerLoader view:popView]; 126 | } 127 | else 128 | { 129 | NSLog(@"reformer not implemention fetchPopControllerWithData:popControllerLoader:view: method"); 130 | } 131 | 132 | 133 | handler.popController = popController; 134 | 135 | [handler.popController presentPopControllerAnimated:YES]; 136 | if (handler && [handler respondsToSelector:@selector(didPresentPopView)]) 137 | { 138 | [handler didPresentPopView]; 139 | } 140 | else 141 | { 142 | NSLog(@"handler not implemention didPresentPopView menthod"); 143 | } 144 | NSLog(@"present popView type:%@,data:%@",NSStringFromClass([popView class]),handler.data); 145 | }; 146 | 147 | #pragma mark --- CSCustomPopHandlerDelegate 148 | 149 | /** 150 | 弹窗消失,对应的handler业务销毁,handler被manager回收释放 151 | @param handler handler业务 152 | */ 153 | - (void)removeHandler:(id)handler 154 | { 155 | [self.handlers removeObject:handler]; 156 | } 157 | 158 | @end 159 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASConstraintMaker.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASConstraintMaker.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "MASConstraint.h" 10 | #import "MASUtilities.h" 11 | 12 | typedef NS_OPTIONS(NSInteger, MASAttribute) { 13 | MASAttributeLeft = 1 << NSLayoutAttributeLeft, 14 | MASAttributeRight = 1 << NSLayoutAttributeRight, 15 | MASAttributeTop = 1 << NSLayoutAttributeTop, 16 | MASAttributeBottom = 1 << NSLayoutAttributeBottom, 17 | MASAttributeLeading = 1 << NSLayoutAttributeLeading, 18 | MASAttributeTrailing = 1 << NSLayoutAttributeTrailing, 19 | MASAttributeWidth = 1 << NSLayoutAttributeWidth, 20 | MASAttributeHeight = 1 << NSLayoutAttributeHeight, 21 | MASAttributeCenterX = 1 << NSLayoutAttributeCenterX, 22 | MASAttributeCenterY = 1 << NSLayoutAttributeCenterY, 23 | MASAttributeBaseline = 1 << NSLayoutAttributeBaseline, 24 | 25 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 26 | 27 | MASAttributeFirstBaseline = 1 << NSLayoutAttributeFirstBaseline, 28 | MASAttributeLastBaseline = 1 << NSLayoutAttributeLastBaseline, 29 | 30 | #endif 31 | 32 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 33 | 34 | MASAttributeLeftMargin = 1 << NSLayoutAttributeLeftMargin, 35 | MASAttributeRightMargin = 1 << NSLayoutAttributeRightMargin, 36 | MASAttributeTopMargin = 1 << NSLayoutAttributeTopMargin, 37 | MASAttributeBottomMargin = 1 << NSLayoutAttributeBottomMargin, 38 | MASAttributeLeadingMargin = 1 << NSLayoutAttributeLeadingMargin, 39 | MASAttributeTrailingMargin = 1 << NSLayoutAttributeTrailingMargin, 40 | MASAttributeCenterXWithinMargins = 1 << NSLayoutAttributeCenterXWithinMargins, 41 | MASAttributeCenterYWithinMargins = 1 << NSLayoutAttributeCenterYWithinMargins, 42 | 43 | #endif 44 | 45 | }; 46 | 47 | /** 48 | * Provides factory methods for creating MASConstraints. 49 | * Constraints are collected until they are ready to be installed 50 | * 51 | */ 52 | @interface MASConstraintMaker : NSObject 53 | 54 | /** 55 | * The following properties return a new MASViewConstraint 56 | * with the first item set to the makers associated view and the appropriate MASViewAttribute 57 | */ 58 | @property (nonatomic, strong, readonly) MASConstraint *left; 59 | @property (nonatomic, strong, readonly) MASConstraint *top; 60 | @property (nonatomic, strong, readonly) MASConstraint *right; 61 | @property (nonatomic, strong, readonly) MASConstraint *bottom; 62 | @property (nonatomic, strong, readonly) MASConstraint *leading; 63 | @property (nonatomic, strong, readonly) MASConstraint *trailing; 64 | @property (nonatomic, strong, readonly) MASConstraint *width; 65 | @property (nonatomic, strong, readonly) MASConstraint *height; 66 | @property (nonatomic, strong, readonly) MASConstraint *centerX; 67 | @property (nonatomic, strong, readonly) MASConstraint *centerY; 68 | @property (nonatomic, strong, readonly) MASConstraint *baseline; 69 | 70 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 71 | 72 | @property (nonatomic, strong, readonly) MASConstraint *firstBaseline; 73 | @property (nonatomic, strong, readonly) MASConstraint *lastBaseline; 74 | 75 | #endif 76 | 77 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 78 | 79 | @property (nonatomic, strong, readonly) MASConstraint *leftMargin; 80 | @property (nonatomic, strong, readonly) MASConstraint *rightMargin; 81 | @property (nonatomic, strong, readonly) MASConstraint *topMargin; 82 | @property (nonatomic, strong, readonly) MASConstraint *bottomMargin; 83 | @property (nonatomic, strong, readonly) MASConstraint *leadingMargin; 84 | @property (nonatomic, strong, readonly) MASConstraint *trailingMargin; 85 | @property (nonatomic, strong, readonly) MASConstraint *centerXWithinMargins; 86 | @property (nonatomic, strong, readonly) MASConstraint *centerYWithinMargins; 87 | 88 | #endif 89 | 90 | /** 91 | * Returns a block which creates a new MASCompositeConstraint with the first item set 92 | * to the makers associated view and children corresponding to the set bits in the 93 | * MASAttribute parameter. Combine multiple attributes via binary-or. 94 | */ 95 | @property (nonatomic, strong, readonly) MASConstraint *(^attributes)(MASAttribute attrs); 96 | 97 | /** 98 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeEdges 99 | * which generates the appropriate MASViewConstraint children (top, left, bottom, right) 100 | * with the first item set to the makers associated view 101 | */ 102 | @property (nonatomic, strong, readonly) MASConstraint *edges; 103 | 104 | /** 105 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeSize 106 | * which generates the appropriate MASViewConstraint children (width, height) 107 | * with the first item set to the makers associated view 108 | */ 109 | @property (nonatomic, strong, readonly) MASConstraint *size; 110 | 111 | /** 112 | * Creates a MASCompositeConstraint with type MASCompositeConstraintTypeCenter 113 | * which generates the appropriate MASViewConstraint children (centerX, centerY) 114 | * with the first item set to the makers associated view 115 | */ 116 | @property (nonatomic, strong, readonly) MASConstraint *center; 117 | 118 | /** 119 | * Whether or not to check for an existing constraint instead of adding constraint 120 | */ 121 | @property (nonatomic, assign) BOOL updateExisting; 122 | 123 | /** 124 | * Whether or not to remove existing constraints prior to installing 125 | */ 126 | @property (nonatomic, assign) BOOL removeExisting; 127 | 128 | /** 129 | * initialises the maker with a default view 130 | * 131 | * @param view any MASConstraint are created with this view as the first item 132 | * 133 | * @return a new MASConstraintMaker 134 | */ 135 | - (id)initWithView:(MAS_VIEW *)view; 136 | 137 | /** 138 | * Calls install method on any MASConstraints which have been created by this maker 139 | * 140 | * @return an array of all the installed MASConstraints 141 | */ 142 | - (NSArray *)install; 143 | 144 | - (MASConstraint * (^)(dispatch_block_t))group; 145 | 146 | @end 147 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/NSLayoutConstraint+MASDebugAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSLayoutConstraint+MASDebugAdditions.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 3/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import "NSLayoutConstraint+MASDebugAdditions.h" 10 | #import "MASConstraint.h" 11 | #import "MASLayoutConstraint.h" 12 | 13 | @implementation NSLayoutConstraint (MASDebugAdditions) 14 | 15 | #pragma mark - description maps 16 | 17 | + (NSDictionary *)layoutRelationDescriptionsByValue { 18 | static dispatch_once_t once; 19 | static NSDictionary *descriptionMap; 20 | dispatch_once(&once, ^{ 21 | descriptionMap = @{ 22 | @(NSLayoutRelationEqual) : @"==", 23 | @(NSLayoutRelationGreaterThanOrEqual) : @">=", 24 | @(NSLayoutRelationLessThanOrEqual) : @"<=", 25 | }; 26 | }); 27 | return descriptionMap; 28 | } 29 | 30 | + (NSDictionary *)layoutAttributeDescriptionsByValue { 31 | static dispatch_once_t once; 32 | static NSDictionary *descriptionMap; 33 | dispatch_once(&once, ^{ 34 | descriptionMap = @{ 35 | @(NSLayoutAttributeTop) : @"top", 36 | @(NSLayoutAttributeLeft) : @"left", 37 | @(NSLayoutAttributeBottom) : @"bottom", 38 | @(NSLayoutAttributeRight) : @"right", 39 | @(NSLayoutAttributeLeading) : @"leading", 40 | @(NSLayoutAttributeTrailing) : @"trailing", 41 | @(NSLayoutAttributeWidth) : @"width", 42 | @(NSLayoutAttributeHeight) : @"height", 43 | @(NSLayoutAttributeCenterX) : @"centerX", 44 | @(NSLayoutAttributeCenterY) : @"centerY", 45 | @(NSLayoutAttributeBaseline) : @"baseline", 46 | 47 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 48 | @(NSLayoutAttributeFirstBaseline) : @"firstBaseline", 49 | @(NSLayoutAttributeLastBaseline) : @"lastBaseline", 50 | #endif 51 | 52 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 53 | @(NSLayoutAttributeLeftMargin) : @"leftMargin", 54 | @(NSLayoutAttributeRightMargin) : @"rightMargin", 55 | @(NSLayoutAttributeTopMargin) : @"topMargin", 56 | @(NSLayoutAttributeBottomMargin) : @"bottomMargin", 57 | @(NSLayoutAttributeLeadingMargin) : @"leadingMargin", 58 | @(NSLayoutAttributeTrailingMargin) : @"trailingMargin", 59 | @(NSLayoutAttributeCenterXWithinMargins) : @"centerXWithinMargins", 60 | @(NSLayoutAttributeCenterYWithinMargins) : @"centerYWithinMargins", 61 | #endif 62 | 63 | }; 64 | 65 | }); 66 | return descriptionMap; 67 | } 68 | 69 | 70 | + (NSDictionary *)layoutPriorityDescriptionsByValue { 71 | static dispatch_once_t once; 72 | static NSDictionary *descriptionMap; 73 | dispatch_once(&once, ^{ 74 | #if TARGET_OS_IPHONE || TARGET_OS_TV 75 | descriptionMap = @{ 76 | @(MASLayoutPriorityDefaultHigh) : @"high", 77 | @(MASLayoutPriorityDefaultLow) : @"low", 78 | @(MASLayoutPriorityDefaultMedium) : @"medium", 79 | @(MASLayoutPriorityRequired) : @"required", 80 | @(MASLayoutPriorityFittingSizeLevel) : @"fitting size", 81 | }; 82 | #elif TARGET_OS_MAC 83 | descriptionMap = @{ 84 | @(MASLayoutPriorityDefaultHigh) : @"high", 85 | @(MASLayoutPriorityDragThatCanResizeWindow) : @"drag can resize window", 86 | @(MASLayoutPriorityDefaultMedium) : @"medium", 87 | @(MASLayoutPriorityWindowSizeStayPut) : @"window size stay put", 88 | @(MASLayoutPriorityDragThatCannotResizeWindow) : @"drag cannot resize window", 89 | @(MASLayoutPriorityDefaultLow) : @"low", 90 | @(MASLayoutPriorityFittingSizeCompression) : @"fitting size", 91 | @(MASLayoutPriorityRequired) : @"required", 92 | }; 93 | #endif 94 | }); 95 | return descriptionMap; 96 | } 97 | 98 | #pragma mark - description override 99 | 100 | + (NSString *)descriptionForObject:(id)obj { 101 | if ([obj respondsToSelector:@selector(mas_key)] && [obj mas_key]) { 102 | return [NSString stringWithFormat:@"%@:%@", [obj class], [obj mas_key]]; 103 | } 104 | return [NSString stringWithFormat:@"%@:%p", [obj class], obj]; 105 | } 106 | 107 | - (NSString *)description { 108 | NSMutableString *description = [[NSMutableString alloc] initWithString:@"<"]; 109 | 110 | [description appendString:[self.class descriptionForObject:self]]; 111 | 112 | [description appendFormat:@" %@", [self.class descriptionForObject:self.firstItem]]; 113 | if (self.firstAttribute != NSLayoutAttributeNotAnAttribute) { 114 | [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.firstAttribute)]]; 115 | } 116 | 117 | [description appendFormat:@" %@", self.class.layoutRelationDescriptionsByValue[@(self.relation)]]; 118 | 119 | if (self.secondItem) { 120 | [description appendFormat:@" %@", [self.class descriptionForObject:self.secondItem]]; 121 | } 122 | if (self.secondAttribute != NSLayoutAttributeNotAnAttribute) { 123 | [description appendFormat:@".%@", self.class.layoutAttributeDescriptionsByValue[@(self.secondAttribute)]]; 124 | } 125 | 126 | if (self.multiplier != 1) { 127 | [description appendFormat:@" * %g", self.multiplier]; 128 | } 129 | 130 | if (self.secondAttribute == NSLayoutAttributeNotAnAttribute) { 131 | [description appendFormat:@" %g", self.constant]; 132 | } else { 133 | if (self.constant) { 134 | [description appendFormat:@" %@ %g", (self.constant < 0 ? @"-" : @"+"), ABS(self.constant)]; 135 | } 136 | } 137 | 138 | if (self.priority != MASLayoutPriorityRequired) { 139 | [description appendFormat:@" ^%@", self.class.layoutPriorityDescriptionsByValue[@(self.priority)] ?: [NSNumber numberWithDouble:self.priority]]; 140 | } 141 | 142 | [description appendString:@">"]; 143 | return description; 144 | } 145 | 146 | @end 147 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSPopController/CSPopAnimation.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopAnimationManager.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/4. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSPopAnimation.h" 10 | 11 | @implementation CSPopAnimation 12 | 13 | - (void)animationWithPop:(BOOL)isPop 14 | { 15 | CGPoint translatePoint = CGPointZero; 16 | CSPPopThemeStyle style; 17 | if (isPop) 18 | { 19 | style = self.theme.presentationStyle; 20 | } 21 | else 22 | { 23 | style = self.theme.dismissStyle; 24 | } 25 | switch (style) 26 | { 27 | case CSPPopThemePresentationStyleNone: 28 | { 29 | self.maskView.alpha = 1.0; 30 | self.content.alpha = 1.0; 31 | return; 32 | break; 33 | } 34 | case CSPPopThemePresentationStyleFadeIn: 35 | { 36 | self.maskView.alpha = 0.0; 37 | self.content.alpha = 0.0; 38 | [UIView animateWithDuration:self.theme.animationPresentionDuration animations:^{ 39 | self.maskView.alpha = 1.0; 40 | self.content.alpha = 1.0; 41 | }]; 42 | return; 43 | break; 44 | } 45 | case CSPPopThemePresentationStyleSlideInFromTop: 46 | case CSPPopThemePresentationStyleSlideInFromTopAndAngleBounce: 47 | translatePoint = CGPointMake(0, -[UIScreen mainScreen].bounds.size.height/2); 48 | break; 49 | case CSPPopThemePresentationStyleSlideInFromBottom: 50 | translatePoint = CGPointMake(0, [UIScreen mainScreen].bounds.size.height/2); 51 | break; 52 | case CSPPopThemePresentationStyleSlideInFromLeft: 53 | translatePoint = CGPointMake(-[UIScreen mainScreen].bounds.size.width/2,0); 54 | break; 55 | case CSPPopThemePresentationStyleSlideInFromRight: 56 | translatePoint = CGPointMake([UIScreen mainScreen].bounds.size.width/2,0); 57 | break; 58 | 59 | case CSPPopThemeDismissStyleNone: 60 | { 61 | self.maskView.alpha = 0.0; 62 | self.content.alpha = 0.0; 63 | if (!self.isNotDismiss) 64 | { 65 | [self.maskView removeFromSuperview]; 66 | [self.content removeFromSuperview]; 67 | } 68 | return; 69 | break; 70 | } 71 | case CSPPopThemeDismissStyleFadeOut: 72 | { 73 | [UIView animateWithDuration:self.theme.animationDismissDuration animations:^{ 74 | self.maskView.alpha = 0.0; 75 | self.content.alpha = 0.0; 76 | } completion:^(BOOL finished) { 77 | if (!self.isNotDismiss) 78 | { 79 | [self.maskView removeFromSuperview]; 80 | [self.content removeFromSuperview]; 81 | } 82 | }]; 83 | return; 84 | break; 85 | } 86 | case CSPPopThemeDismissStyleSlideInToTop: 87 | translatePoint = CGPointMake(0, -[UIScreen mainScreen].bounds.size.height/2); 88 | break; 89 | case CSPPopThemeDismissStyleSlideInToBottom: 90 | case CSPPopThemeDismissStyleSlideInToBottomAndAngle: 91 | translatePoint = CGPointMake(0, [UIScreen mainScreen].bounds.size.height/2); 92 | break; 93 | case CSPPopThemeDismissStyleSlideInToPointAndScale: 94 | translatePoint = CGPointMake(self.theme.dismissPoint.x-self.content.center.x, self.theme.dismissPoint.y-self.content.center.y); 95 | break; 96 | case CSPPopThemeDismissStyleSlideInToLeft: 97 | translatePoint = CGPointMake(-[UIScreen mainScreen].bounds.size.width/2,0); 98 | break; 99 | case CSPPopThemeDismissStyleSlideInToRight: 100 | translatePoint = CGPointMake([UIScreen mainScreen].bounds.size.width/2,0); 101 | break; 102 | default: 103 | break; 104 | } 105 | 106 | if (isPop) 107 | { 108 | self.maskView.alpha = 0.0; 109 | self.content.alpha = 0.0; 110 | CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI_4/5.0); 111 | if (style == CSPPopThemePresentationStyleSlideInFromTopAndAngleBounce) 112 | { 113 | transform = CGAffineTransformTranslate(transform, translatePoint.x, translatePoint.y); 114 | } 115 | else 116 | { 117 | transform = CGAffineTransformMakeTranslation(translatePoint.x,translatePoint.y); 118 | } 119 | self.content.transform = transform;; 120 | 121 | [UIView animateWithDuration:self.theme.animationPresentionDuration delay:0 usingSpringWithDamping:0.6 initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveLinear animations:^{ 122 | self.content.transform = CGAffineTransformIdentity; 123 | self.maskView.alpha = 1.0; 124 | self.content.alpha = 1.0; 125 | } completion:^(BOOL finished) { 126 | 127 | }]; 128 | } 129 | else 130 | { 131 | [UIView animateWithDuration:self.theme.animationDismissDuration animations:^{ 132 | 133 | CGAffineTransform transform = CGAffineTransformIdentity; 134 | if (style == CSPPopThemeDismissStyleSlideInToPointAndScale) 135 | { 136 | transform = CGAffineTransformMakeTranslation(translatePoint.x, translatePoint.y); 137 | transform = CGAffineTransformScale(transform, 0.01, 0.01); 138 | } 139 | else if (style == CSPPopThemeDismissStyleSlideInToBottomAndAngle) 140 | { 141 | transform = CGAffineTransformMakeRotation(-M_PI_4/5.0); 142 | transform = CGAffineTransformTranslate(transform, translatePoint.x, translatePoint.y); 143 | } 144 | else 145 | { 146 | transform = CGAffineTransformMakeTranslation(translatePoint.x,translatePoint.y); 147 | } 148 | 149 | self.content.transform = transform; 150 | 151 | self.maskView.alpha = 0.0; 152 | self.content.alpha = 0.0; 153 | 154 | } completion:^(BOOL finished) { 155 | if (!self.isNotDismiss) 156 | { 157 | [self.maskView removeFromSuperview]; 158 | [self.content removeFromSuperview]; 159 | } 160 | [[NSNotificationCenter defaultCenter] postNotificationName:CSPopControllerDissmissNotification object:self]; 161 | }]; 162 | } 163 | } 164 | 165 | 166 | @end 167 | 168 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_Tests-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | 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}" || true 60 | 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} 61 | ;; 62 | *.xib) 63 | 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}" || true 64 | 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} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | 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}" 115 | else 116 | 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}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_BUILD_DIR}/assetcatalog_generated_info.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Example/Pods-CSPopKit_Example-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then 7 | # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # resources to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 13 | 14 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 15 | > "$RESOURCES_TO_COPY" 16 | 17 | XCASSET_FILES=() 18 | 19 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 20 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 21 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 22 | 23 | case "${TARGETED_DEVICE_FAMILY:-}" in 24 | 1,2) 25 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 26 | ;; 27 | 1) 28 | TARGET_DEVICE_ARGS="--target-device iphone" 29 | ;; 30 | 2) 31 | TARGET_DEVICE_ARGS="--target-device ipad" 32 | ;; 33 | 3) 34 | TARGET_DEVICE_ARGS="--target-device tv" 35 | ;; 36 | 4) 37 | TARGET_DEVICE_ARGS="--target-device watch" 38 | ;; 39 | *) 40 | TARGET_DEVICE_ARGS="--target-device mac" 41 | ;; 42 | esac 43 | 44 | install_resource() 45 | { 46 | if [[ "$1" = /* ]] ; then 47 | RESOURCE_PATH="$1" 48 | else 49 | RESOURCE_PATH="${PODS_ROOT}/$1" 50 | fi 51 | if [[ ! -e "$RESOURCE_PATH" ]] ; then 52 | cat << EOM 53 | error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. 54 | EOM 55 | exit 1 56 | fi 57 | case $RESOURCE_PATH in 58 | *.storyboard) 59 | 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}" || true 60 | 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} 61 | ;; 62 | *.xib) 63 | 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}" || true 64 | 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} 65 | ;; 66 | *.framework) 67 | echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 68 | mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 69 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true 70 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 71 | ;; 72 | *.xcdatamodel) 73 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true 74 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" 75 | ;; 76 | *.xcdatamodeld) 77 | echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true 78 | xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" 79 | ;; 80 | *.xcmappingmodel) 81 | echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true 82 | xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" 83 | ;; 84 | *.xcassets) 85 | ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" 86 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 87 | ;; 88 | *) 89 | echo "$RESOURCE_PATH" || true 90 | echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" 91 | ;; 92 | esac 93 | } 94 | 95 | mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 96 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 97 | if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then 98 | mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 99 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 100 | fi 101 | rm -f "$RESOURCES_TO_COPY" 102 | 103 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ] 104 | then 105 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 106 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 107 | while read line; do 108 | if [[ $line != "${PODS_ROOT}*" ]]; then 109 | XCASSET_FILES+=("$line") 110 | fi 111 | done <<<"$OTHER_XCASSETS" 112 | 113 | if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then 114 | 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}" 115 | else 116 | 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}" --app-icon "${ASSETCATALOG_COMPILER_APPICON_NAME}" --output-partial-info-plist "${TARGET_BUILD_DIR}/assetcatalog_generated_info.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/MASUtilities.h: -------------------------------------------------------------------------------- 1 | // 2 | // MASUtilities.h 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 19/08/13. 6 | // Copyright (c) 2013 Jonas Budelmann. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | 13 | #if TARGET_OS_IPHONE || TARGET_OS_TV 14 | 15 | #import 16 | #define MAS_VIEW UIView 17 | #define MAS_VIEW_CONTROLLER UIViewController 18 | #define MASEdgeInsets UIEdgeInsets 19 | 20 | typedef UILayoutPriority MASLayoutPriority; 21 | static const MASLayoutPriority MASLayoutPriorityRequired = UILayoutPriorityRequired; 22 | static const MASLayoutPriority MASLayoutPriorityDefaultHigh = UILayoutPriorityDefaultHigh; 23 | static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 500; 24 | static const MASLayoutPriority MASLayoutPriorityDefaultLow = UILayoutPriorityDefaultLow; 25 | static const MASLayoutPriority MASLayoutPriorityFittingSizeLevel = UILayoutPriorityFittingSizeLevel; 26 | 27 | #elif TARGET_OS_MAC 28 | 29 | #import 30 | #define MAS_VIEW NSView 31 | #define MASEdgeInsets NSEdgeInsets 32 | 33 | typedef NSLayoutPriority MASLayoutPriority; 34 | static const MASLayoutPriority MASLayoutPriorityRequired = NSLayoutPriorityRequired; 35 | static const MASLayoutPriority MASLayoutPriorityDefaultHigh = NSLayoutPriorityDefaultHigh; 36 | static const MASLayoutPriority MASLayoutPriorityDragThatCanResizeWindow = NSLayoutPriorityDragThatCanResizeWindow; 37 | static const MASLayoutPriority MASLayoutPriorityDefaultMedium = 501; 38 | static const MASLayoutPriority MASLayoutPriorityWindowSizeStayPut = NSLayoutPriorityWindowSizeStayPut; 39 | static const MASLayoutPriority MASLayoutPriorityDragThatCannotResizeWindow = NSLayoutPriorityDragThatCannotResizeWindow; 40 | static const MASLayoutPriority MASLayoutPriorityDefaultLow = NSLayoutPriorityDefaultLow; 41 | static const MASLayoutPriority MASLayoutPriorityFittingSizeCompression = NSLayoutPriorityFittingSizeCompression; 42 | 43 | #endif 44 | 45 | /** 46 | * Allows you to attach keys to objects matching the variable names passed. 47 | * 48 | * view1.mas_key = @"view1", view2.mas_key = @"view2"; 49 | * 50 | * is equivalent to: 51 | * 52 | * MASAttachKeys(view1, view2); 53 | */ 54 | #define MASAttachKeys(...) \ 55 | { \ 56 | NSDictionary *keyPairs = NSDictionaryOfVariableBindings(__VA_ARGS__); \ 57 | for (id key in keyPairs.allKeys) { \ 58 | id obj = keyPairs[key]; \ 59 | NSAssert([obj respondsToSelector:@selector(setMas_key:)], \ 60 | @"Cannot attach mas_key to %@", obj); \ 61 | [obj setMas_key:key]; \ 62 | } \ 63 | } 64 | 65 | /** 66 | * Used to create object hashes 67 | * Based on http://www.mikeash.com/pyblog/friday-qa-2010-06-18-implementing-equality-and-hashing.html 68 | */ 69 | #define MAS_NSUINT_BIT (CHAR_BIT * sizeof(NSUInteger)) 70 | #define MAS_NSUINTROTATE(val, howmuch) ((((NSUInteger)val) << howmuch) | (((NSUInteger)val) >> (MAS_NSUINT_BIT - howmuch))) 71 | 72 | /** 73 | * Given a scalar or struct value, wraps it in NSValue 74 | * Based on EXPObjectify: https://github.com/specta/expecta 75 | */ 76 | static inline id _MASBoxValue(const char *type, ...) { 77 | va_list v; 78 | va_start(v, type); 79 | id obj = nil; 80 | if (strcmp(type, @encode(id)) == 0) { 81 | id actual = va_arg(v, id); 82 | obj = actual; 83 | } else if (strcmp(type, @encode(CGPoint)) == 0) { 84 | CGPoint actual = (CGPoint)va_arg(v, CGPoint); 85 | obj = [NSValue value:&actual withObjCType:type]; 86 | } else if (strcmp(type, @encode(CGSize)) == 0) { 87 | CGSize actual = (CGSize)va_arg(v, CGSize); 88 | obj = [NSValue value:&actual withObjCType:type]; 89 | } else if (strcmp(type, @encode(MASEdgeInsets)) == 0) { 90 | MASEdgeInsets actual = (MASEdgeInsets)va_arg(v, MASEdgeInsets); 91 | obj = [NSValue value:&actual withObjCType:type]; 92 | } else if (strcmp(type, @encode(double)) == 0) { 93 | double actual = (double)va_arg(v, double); 94 | obj = [NSNumber numberWithDouble:actual]; 95 | } else if (strcmp(type, @encode(float)) == 0) { 96 | float actual = (float)va_arg(v, double); 97 | obj = [NSNumber numberWithFloat:actual]; 98 | } else if (strcmp(type, @encode(int)) == 0) { 99 | int actual = (int)va_arg(v, int); 100 | obj = [NSNumber numberWithInt:actual]; 101 | } else if (strcmp(type, @encode(long)) == 0) { 102 | long actual = (long)va_arg(v, long); 103 | obj = [NSNumber numberWithLong:actual]; 104 | } else if (strcmp(type, @encode(long long)) == 0) { 105 | long long actual = (long long)va_arg(v, long long); 106 | obj = [NSNumber numberWithLongLong:actual]; 107 | } else if (strcmp(type, @encode(short)) == 0) { 108 | short actual = (short)va_arg(v, int); 109 | obj = [NSNumber numberWithShort:actual]; 110 | } else if (strcmp(type, @encode(char)) == 0) { 111 | char actual = (char)va_arg(v, int); 112 | obj = [NSNumber numberWithChar:actual]; 113 | } else if (strcmp(type, @encode(bool)) == 0) { 114 | bool actual = (bool)va_arg(v, int); 115 | obj = [NSNumber numberWithBool:actual]; 116 | } else if (strcmp(type, @encode(unsigned char)) == 0) { 117 | unsigned char actual = (unsigned char)va_arg(v, unsigned int); 118 | obj = [NSNumber numberWithUnsignedChar:actual]; 119 | } else if (strcmp(type, @encode(unsigned int)) == 0) { 120 | unsigned int actual = (unsigned int)va_arg(v, unsigned int); 121 | obj = [NSNumber numberWithUnsignedInt:actual]; 122 | } else if (strcmp(type, @encode(unsigned long)) == 0) { 123 | unsigned long actual = (unsigned long)va_arg(v, unsigned long); 124 | obj = [NSNumber numberWithUnsignedLong:actual]; 125 | } else if (strcmp(type, @encode(unsigned long long)) == 0) { 126 | unsigned long long actual = (unsigned long long)va_arg(v, unsigned long long); 127 | obj = [NSNumber numberWithUnsignedLongLong:actual]; 128 | } else if (strcmp(type, @encode(unsigned short)) == 0) { 129 | unsigned short actual = (unsigned short)va_arg(v, unsigned int); 130 | obj = [NSNumber numberWithUnsignedShort:actual]; 131 | } 132 | va_end(v); 133 | return obj; 134 | } 135 | 136 | #define MASBoxValue(value) _MASBoxValue(@encode(__typeof__((value))), (value)) 137 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/NSArray+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSArray+MASAdditions.m 3 | // 4 | // 5 | // Created by Daniel Hammond on 11/26/13. 6 | // 7 | // 8 | 9 | #import "NSArray+MASAdditions.h" 10 | #import "View+MASAdditions.h" 11 | 12 | @implementation NSArray (MASAdditions) 13 | 14 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block { 15 | NSMutableArray *constraints = [NSMutableArray array]; 16 | for (MAS_VIEW *view in self) { 17 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); 18 | [constraints addObjectsFromArray:[view mas_makeConstraints:block]]; 19 | } 20 | return constraints; 21 | } 22 | 23 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block { 24 | NSMutableArray *constraints = [NSMutableArray array]; 25 | for (MAS_VIEW *view in self) { 26 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); 27 | [constraints addObjectsFromArray:[view mas_updateConstraints:block]]; 28 | } 29 | return constraints; 30 | } 31 | 32 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block { 33 | NSMutableArray *constraints = [NSMutableArray array]; 34 | for (MAS_VIEW *view in self) { 35 | NSAssert([view isKindOfClass:[MAS_VIEW class]], @"All objects in the array must be views"); 36 | [constraints addObjectsFromArray:[view mas_remakeConstraints:block]]; 37 | } 38 | return constraints; 39 | } 40 | 41 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)fixedSpacing leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing { 42 | if (self.count < 2) { 43 | NSAssert(self.count>1,@"views to distribute need to bigger than one"); 44 | return; 45 | } 46 | 47 | MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews]; 48 | if (axisType == MASAxisTypeHorizontal) { 49 | MAS_VIEW *prev; 50 | for (int i = 0; i < self.count; i++) { 51 | MAS_VIEW *v = self[i]; 52 | [v mas_makeConstraints:^(MASConstraintMaker *make) { 53 | if (prev) { 54 | make.width.equalTo(prev); 55 | make.left.equalTo(prev.mas_right).offset(fixedSpacing); 56 | if (i == self.count - 1) {//last one 57 | make.right.equalTo(tempSuperView).offset(-tailSpacing); 58 | } 59 | } 60 | else {//first one 61 | make.left.equalTo(tempSuperView).offset(leadSpacing); 62 | } 63 | 64 | }]; 65 | prev = v; 66 | } 67 | } 68 | else { 69 | MAS_VIEW *prev; 70 | for (int i = 0; i < self.count; i++) { 71 | MAS_VIEW *v = self[i]; 72 | [v mas_makeConstraints:^(MASConstraintMaker *make) { 73 | if (prev) { 74 | make.height.equalTo(prev); 75 | make.top.equalTo(prev.mas_bottom).offset(fixedSpacing); 76 | if (i == self.count - 1) {//last one 77 | make.bottom.equalTo(tempSuperView).offset(-tailSpacing); 78 | } 79 | } 80 | else {//first one 81 | make.top.equalTo(tempSuperView).offset(leadSpacing); 82 | } 83 | 84 | }]; 85 | prev = v; 86 | } 87 | } 88 | } 89 | 90 | - (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)fixedItemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing { 91 | if (self.count < 2) { 92 | NSAssert(self.count>1,@"views to distribute need to bigger than one"); 93 | return; 94 | } 95 | 96 | MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews]; 97 | if (axisType == MASAxisTypeHorizontal) { 98 | MAS_VIEW *prev; 99 | for (int i = 0; i < self.count; i++) { 100 | MAS_VIEW *v = self[i]; 101 | [v mas_makeConstraints:^(MASConstraintMaker *make) { 102 | make.width.equalTo(@(fixedItemLength)); 103 | if (prev) { 104 | if (i == self.count - 1) {//last one 105 | make.right.equalTo(tempSuperView).offset(-tailSpacing); 106 | } 107 | else { 108 | CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1)); 109 | make.right.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset); 110 | } 111 | } 112 | else {//first one 113 | make.left.equalTo(tempSuperView).offset(leadSpacing); 114 | } 115 | }]; 116 | prev = v; 117 | } 118 | } 119 | else { 120 | MAS_VIEW *prev; 121 | for (int i = 0; i < self.count; i++) { 122 | MAS_VIEW *v = self[i]; 123 | [v mas_makeConstraints:^(MASConstraintMaker *make) { 124 | make.height.equalTo(@(fixedItemLength)); 125 | if (prev) { 126 | if (i == self.count - 1) {//last one 127 | make.bottom.equalTo(tempSuperView).offset(-tailSpacing); 128 | } 129 | else { 130 | CGFloat offset = (1-(i/((CGFloat)self.count-1)))*(fixedItemLength+leadSpacing)-i*tailSpacing/(((CGFloat)self.count-1)); 131 | make.bottom.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset); 132 | } 133 | } 134 | else {//first one 135 | make.top.equalTo(tempSuperView).offset(leadSpacing); 136 | } 137 | }]; 138 | prev = v; 139 | } 140 | } 141 | } 142 | 143 | - (MAS_VIEW *)mas_commonSuperviewOfViews 144 | { 145 | MAS_VIEW *commonSuperview = nil; 146 | MAS_VIEW *previousView = nil; 147 | for (id object in self) { 148 | if ([object isKindOfClass:[MAS_VIEW class]]) { 149 | MAS_VIEW *view = (MAS_VIEW *)object; 150 | if (previousView) { 151 | commonSuperview = [view mas_closestCommonSuperview:commonSuperview]; 152 | } else { 153 | commonSuperview = view; 154 | } 155 | previousView = view; 156 | } 157 | } 158 | NSAssert(commonSuperview, @"Can't constrain views that do not share a common superview. Make sure that all the views in this array have been added into the same view hierarchy."); 159 | return commonSuperview; 160 | } 161 | 162 | @end 163 | -------------------------------------------------------------------------------- /CSPopKit/Classes/CSPopController/CSPopController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CSPopController.m 3 | // CSPopKit 4 | // 5 | // Created by joy_yu on 2018/1/4. 6 | // Copyright © 2018年 joy_yu. All rights reserved. 7 | // 8 | 9 | #import "CSPopController.h" 10 | #import "CSPopAnimation.h" 11 | #import "Masonry.h" 12 | 13 | NSString *const CSPopControllerDissmissNotification = @"CSPopControllerDissmissNotification"; 14 | 15 | static inline UIViewAnimationOptions UIViewAnimationCurveToAnimationOptions(UIViewAnimationCurve curve) 16 | { 17 | return curve << 16; 18 | } 19 | 20 | @interface CSPopController() 21 | 22 | /** 23 | 外界自定义视图:需要满足autolayOut约束,可做到自适应高度 24 | */ 25 | @property (nonatomic,strong) UIView *content; 26 | 27 | /** 28 | window 29 | */ 30 | @property (nonatomic, strong) UIWindow *applicationWindow; 31 | 32 | /** 33 | 蒙版 34 | */ 35 | @property (nonatomic, strong) UIView *maskView; 36 | 37 | /** 38 | 动画处理类:present,dismiss 39 | */ 40 | @property (nonatomic, strong) CSPopAnimation *animationHandler; 41 | 42 | @end 43 | 44 | @implementation CSPopController 45 | 46 | - (instancetype)initWithContent:(UIView *)content 47 | { 48 | self = [super init]; 49 | if (self) 50 | { 51 | self.content = content; 52 | content.layer.masksToBounds = YES; 53 | 54 | UIView *maskView = [[UIView alloc] initWithFrame:self.applicationWindow.bounds]; 55 | UITapGestureRecognizer *backgroundTapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapAction:)]; 56 | self.maskView = maskView; 57 | maskView.hidden = YES; 58 | [self.applicationWindow addSubview:maskView]; 59 | [maskView addGestureRecognizer:backgroundTapRecognizer]; 60 | [maskView mas_makeConstraints:^(MASConstraintMaker *make) { 61 | (void)make.left.right.top.bottom; 62 | }]; 63 | 64 | [self.applicationWindow addSubview:content]; 65 | 66 | CSPopTheme *theme = [CSPopTheme defaultTheme]; 67 | self.content.hidden = YES; 68 | self.theme = theme; 69 | [self applyTheme]; 70 | 71 | CSPopAnimation *animationHandler = [[CSPopAnimation alloc] init]; 72 | animationHandler.content = content; 73 | animationHandler.maskView = maskView; 74 | animationHandler.popController = self; 75 | self.animationHandler = animationHandler; 76 | 77 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; 78 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil]; 79 | } 80 | return self; 81 | } 82 | 83 | - (void)dealloc 84 | { 85 | NSLog(@"popController dealloc"); 86 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; 87 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; 88 | } 89 | 90 | - (void)setTheme:(CSPopTheme *)theme 91 | { 92 | if (_theme != theme) 93 | { 94 | _theme = theme; 95 | [self applyTheme]; 96 | } 97 | _theme = theme; 98 | } 99 | 100 | - (void)applyTheme 101 | { 102 | if (self.theme.maskType == CSPopThemeMaskTypeClear) 103 | { 104 | self.maskView.backgroundColor = [UIColor clearColor]; 105 | } 106 | else if (self.theme.maskType == CSPopThemeMaskTypeDimmed) 107 | { 108 | self.maskView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.7]; 109 | } 110 | self.animationHandler.theme = self.theme; 111 | // self.content.backgroundColor = self.theme.backgroundColor; 112 | [self.content mas_updateConstraints:^(MASConstraintMaker *make) { 113 | make.centerY.mas_offset(self.theme.verticalOffset); 114 | make.centerX.mas_offset(-self.theme.horizontalOffset); 115 | make.width.mas_equalTo(self.theme.maxPopupWidth); 116 | }]; 117 | self.content.layer.cornerRadius = self.theme.cornerRadius; 118 | } 119 | 120 | - (void)presentPopControllerAnimated:(BOOL)flag 121 | { 122 | self.content.hidden = NO; 123 | self.maskView.hidden = NO; 124 | if (flag) 125 | { 126 | [self.animationHandler animationWithPop:YES]; 127 | } 128 | } 129 | 130 | - (void)backgroundTapAction:(UITapGestureRecognizer *)gesture 131 | { 132 | if (self.theme.shouldDismissOnBackgroundTouch) 133 | { 134 | [self dismissPopControllerAnimated:YES]; 135 | } 136 | } 137 | 138 | - (void)dismissPopControllerAnimated:(BOOL)flag 139 | { 140 | if (flag) 141 | { 142 | [self.animationHandler animationWithPop:NO]; 143 | } 144 | else 145 | { 146 | [self.maskView removeFromSuperview]; 147 | [self.content removeFromSuperview]; 148 | } 149 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; 150 | [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil]; 151 | } 152 | 153 | - (UIWindow *)applicationWindow 154 | { 155 | return [UIApplication sharedApplication].keyWindow; 156 | } 157 | 158 | - (void)keyboardWillShow:(NSNotification *)notification 159 | { 160 | CGRect frame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue]; 161 | NSTimeInterval duration = [(notification.userInfo)[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; 162 | UIViewAnimationCurve curve = [(notification.userInfo)[UIKeyboardAnimationCurveUserInfoKey] integerValue]; 163 | CGRect popupViewIntersection = CGRectIntersection(self.content.frame, frame); 164 | CGFloat margin; 165 | if ([UIScreen mainScreen].bounds.size.width <= 320.f) 166 | { 167 | margin = 25; 168 | } 169 | else 170 | { 171 | margin = 80; 172 | } 173 | CGFloat intersectionHeight = popupViewIntersection.size.height + margin; 174 | if (intersectionHeight > 0) 175 | { 176 | [self.content mas_updateConstraints:^(MASConstraintMaker *make) { 177 | (void)make.centerY.offset(-intersectionHeight); 178 | }]; 179 | 180 | [UIView animateWithDuration:duration delay:0.0f options:UIViewAnimationCurveToAnimationOptions(curve) animations:^{ 181 | [self.content.superview layoutIfNeeded]; 182 | } completion:nil]; 183 | } 184 | } 185 | 186 | - (void)keyboardWillHide:(NSNotification *)notification 187 | { 188 | NSTimeInterval duration = [(notification.userInfo)[UIKeyboardAnimationDurationUserInfoKey] doubleValue]; 189 | UIViewAnimationCurve curve = [(notification.userInfo)[UIKeyboardAnimationCurveUserInfoKey] integerValue]; 190 | [self.content mas_updateConstraints:^(MASConstraintMaker *make) { 191 | (void)make.center; 192 | }]; 193 | [UIView animateWithDuration:duration delay:0.0f options:UIViewAnimationCurveToAnimationOptions(curve) animations:^{ 194 | [self.content.superview layoutIfNeeded]; 195 | } completion:nil]; 196 | } 197 | 198 | @end 199 | -------------------------------------------------------------------------------- /Example/Pods/Target Support Files/Pods-CSPopKit_Tests/Pods-CSPopKit_Tests-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 7 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 8 | # frameworks to, so exit 0 (signalling the script phase was successful). 9 | exit 0 10 | fi 11 | 12 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 13 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 14 | 15 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 16 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 17 | 18 | # Used as a return value for each invocation of `strip_invalid_archs` function. 19 | STRIP_BINARY_RETVAL=0 20 | 21 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 22 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 23 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 24 | 25 | # Copies and strips a vendored framework 26 | install_framework() 27 | { 28 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 29 | local source="${BUILT_PRODUCTS_DIR}/$1" 30 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 31 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 32 | elif [ -r "$1" ]; then 33 | local source="$1" 34 | fi 35 | 36 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 37 | 38 | if [ -L "${source}" ]; then 39 | echo "Symlinked..." 40 | source="$(readlink "${source}")" 41 | fi 42 | 43 | # Use filter instead of exclude so missing patterns don't throw errors. 44 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 45 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 46 | 47 | local basename 48 | basename="$(basename -s .framework "$1")" 49 | binary="${destination}/${basename}.framework/${basename}" 50 | if ! [ -r "$binary" ]; then 51 | binary="${destination}/${basename}" 52 | fi 53 | 54 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 55 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 56 | strip_invalid_archs "$binary" 57 | fi 58 | 59 | # Resign the code if required by the build settings to avoid unstable apps 60 | code_sign_if_enabled "${destination}/$(basename "$1")" 61 | 62 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 63 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 64 | local swift_runtime_libs 65 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) 66 | for lib in $swift_runtime_libs; do 67 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 68 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 69 | code_sign_if_enabled "${destination}/${lib}" 70 | done 71 | fi 72 | } 73 | 74 | # Copies and strips a vendored dSYM 75 | install_dsym() { 76 | local source="$1" 77 | if [ -r "$source" ]; then 78 | # Copy the dSYM into a the targets temp dir. 79 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" 80 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" 81 | 82 | local basename 83 | basename="$(basename -s .framework.dSYM "$source")" 84 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 85 | 86 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 87 | if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then 88 | strip_invalid_archs "$binary" 89 | fi 90 | 91 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 92 | # Move the stripped file into its final destination. 93 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" 94 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}" 95 | else 96 | # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. 97 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 98 | fi 99 | fi 100 | } 101 | 102 | # Signs a framework with the provided identity 103 | code_sign_if_enabled() { 104 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 105 | # Use the current code_sign_identitiy 106 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 107 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 108 | 109 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 110 | code_sign_cmd="$code_sign_cmd &" 111 | fi 112 | echo "$code_sign_cmd" 113 | eval "$code_sign_cmd" 114 | fi 115 | } 116 | 117 | # Strip invalid architectures 118 | strip_invalid_archs() { 119 | binary="$1" 120 | # Get architectures for current target binary 121 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 122 | # Intersect them with the architectures we are building for 123 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 124 | # If there are no archs supported by this binary then warn the user 125 | if [[ -z "$intersected_archs" ]]; then 126 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 127 | STRIP_BINARY_RETVAL=0 128 | return 129 | fi 130 | stripped="" 131 | for arch in $binary_archs; do 132 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 133 | # Strip non-valid architectures in-place 134 | lipo -remove "$arch" -output "$binary" "$binary" || exit 1 135 | stripped="$stripped $arch" 136 | fi 137 | done 138 | if [[ "$stripped" ]]; then 139 | echo "Stripped $binary of architectures:$stripped" 140 | fi 141 | STRIP_BINARY_RETVAL=1 142 | } 143 | 144 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 145 | wait 146 | fi 147 | -------------------------------------------------------------------------------- /Example/Pods/Masonry/Masonry/View+MASAdditions.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIView+MASAdditions.m 3 | // Masonry 4 | // 5 | // Created by Jonas Budelmann on 20/07/13. 6 | // Copyright (c) 2013 cloudling. All rights reserved. 7 | // 8 | 9 | #import "View+MASAdditions.h" 10 | #import 11 | 12 | @implementation MAS_VIEW (MASAdditions) 13 | 14 | - (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *))block { 15 | self.translatesAutoresizingMaskIntoConstraints = NO; 16 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 17 | block(constraintMaker); 18 | return [constraintMaker install]; 19 | } 20 | 21 | - (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *))block { 22 | self.translatesAutoresizingMaskIntoConstraints = NO; 23 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 24 | constraintMaker.updateExisting = YES; 25 | block(constraintMaker); 26 | return [constraintMaker install]; 27 | } 28 | 29 | - (NSArray *)mas_remakeConstraints:(void(^)(MASConstraintMaker *make))block { 30 | self.translatesAutoresizingMaskIntoConstraints = NO; 31 | MASConstraintMaker *constraintMaker = [[MASConstraintMaker alloc] initWithView:self]; 32 | constraintMaker.removeExisting = YES; 33 | block(constraintMaker); 34 | return [constraintMaker install]; 35 | } 36 | 37 | #pragma mark - NSLayoutAttribute properties 38 | 39 | - (MASViewAttribute *)mas_left { 40 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeft]; 41 | } 42 | 43 | - (MASViewAttribute *)mas_top { 44 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTop]; 45 | } 46 | 47 | - (MASViewAttribute *)mas_right { 48 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRight]; 49 | } 50 | 51 | - (MASViewAttribute *)mas_bottom { 52 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottom]; 53 | } 54 | 55 | - (MASViewAttribute *)mas_leading { 56 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeading]; 57 | } 58 | 59 | - (MASViewAttribute *)mas_trailing { 60 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailing]; 61 | } 62 | 63 | - (MASViewAttribute *)mas_width { 64 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeWidth]; 65 | } 66 | 67 | - (MASViewAttribute *)mas_height { 68 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeHeight]; 69 | } 70 | 71 | - (MASViewAttribute *)mas_centerX { 72 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterX]; 73 | } 74 | 75 | - (MASViewAttribute *)mas_centerY { 76 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterY]; 77 | } 78 | 79 | - (MASViewAttribute *)mas_baseline { 80 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline]; 81 | } 82 | 83 | - (MASViewAttribute *(^)(NSLayoutAttribute))mas_attribute 84 | { 85 | return ^(NSLayoutAttribute attr) { 86 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:attr]; 87 | }; 88 | } 89 | 90 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) 91 | 92 | - (MASViewAttribute *)mas_firstBaseline { 93 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeFirstBaseline]; 94 | } 95 | - (MASViewAttribute *)mas_lastBaseline { 96 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLastBaseline]; 97 | } 98 | 99 | #endif 100 | 101 | #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 9000) 102 | 103 | - (MASViewAttribute *)mas_leftMargin { 104 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeftMargin]; 105 | } 106 | 107 | - (MASViewAttribute *)mas_rightMargin { 108 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeRightMargin]; 109 | } 110 | 111 | - (MASViewAttribute *)mas_topMargin { 112 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTopMargin]; 113 | } 114 | 115 | - (MASViewAttribute *)mas_bottomMargin { 116 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBottomMargin]; 117 | } 118 | 119 | - (MASViewAttribute *)mas_leadingMargin { 120 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeLeadingMargin]; 121 | } 122 | 123 | - (MASViewAttribute *)mas_trailingMargin { 124 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeTrailingMargin]; 125 | } 126 | 127 | - (MASViewAttribute *)mas_centerXWithinMargins { 128 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterXWithinMargins]; 129 | } 130 | 131 | - (MASViewAttribute *)mas_centerYWithinMargins { 132 | return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeCenterYWithinMargins]; 133 | } 134 | 135 | #endif 136 | 137 | #if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000) 138 | 139 | - (MASViewAttribute *)mas_safeAreaLayoutGuide { 140 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 141 | } 142 | - (MASViewAttribute *)mas_safeAreaLayoutGuideTop { 143 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeTop]; 144 | } 145 | - (MASViewAttribute *)mas_safeAreaLayoutGuideBottom { 146 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeBottom]; 147 | } 148 | - (MASViewAttribute *)mas_safeAreaLayoutGuideLeft { 149 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeLeft]; 150 | } 151 | - (MASViewAttribute *)mas_safeAreaLayoutGuideRight { 152 | return [[MASViewAttribute alloc] initWithView:self item:self.safeAreaLayoutGuide layoutAttribute:NSLayoutAttributeRight]; 153 | } 154 | 155 | #endif 156 | 157 | #pragma mark - associated properties 158 | 159 | - (id)mas_key { 160 | return objc_getAssociatedObject(self, @selector(mas_key)); 161 | } 162 | 163 | - (void)setMas_key:(id)key { 164 | objc_setAssociatedObject(self, @selector(mas_key), key, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 165 | } 166 | 167 | #pragma mark - heirachy 168 | 169 | - (instancetype)mas_closestCommonSuperview:(MAS_VIEW *)view { 170 | MAS_VIEW *closestCommonSuperview = nil; 171 | 172 | MAS_VIEW *secondViewSuperview = view; 173 | while (!closestCommonSuperview && secondViewSuperview) { 174 | MAS_VIEW *firstViewSuperview = self; 175 | while (!closestCommonSuperview && firstViewSuperview) { 176 | if (secondViewSuperview == firstViewSuperview) { 177 | closestCommonSuperview = secondViewSuperview; 178 | } 179 | firstViewSuperview = firstViewSuperview.superview; 180 | } 181 | secondViewSuperview = secondViewSuperview.superview; 182 | } 183 | return closestCommonSuperview; 184 | } 185 | 186 | @end 187 | --------------------------------------------------------------------------------