├── .gitignore ├── .slather.yml ├── .travis.yml ├── Examples ├── Demo-objc │ ├── Demo-objc.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── Demo-objc.xcscheme │ ├── Demo-objc.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Demo-objc │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon.png │ │ │ │ ├── icon_20pt.png │ │ │ │ ├── icon_20pt@2x-1.png │ │ │ │ ├── icon_20pt@2x.png │ │ │ │ ├── icon_20pt@3x.png │ │ │ │ ├── icon_29pt.png │ │ │ │ ├── icon_29pt@2x-1.png │ │ │ │ ├── icon_29pt@2x.png │ │ │ │ ├── icon_29pt@3x.png │ │ │ │ ├── icon_40pt.png │ │ │ │ ├── icon_40pt@2x-1.png │ │ │ │ ├── icon_40pt@2x.png │ │ │ │ ├── icon_60pt@2x-1.png │ │ │ │ ├── icon_60pt@2x.png │ │ │ │ ├── icon_60pt@3x.png │ │ │ │ ├── icon_76pt.png │ │ │ │ ├── icon_76pt@2x.png │ │ │ │ └── icon_83.5@2x.png │ │ │ ├── Contents.json │ │ │ ├── blue.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── blue@3x.png │ │ │ ├── green.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── green@3x.png │ │ │ ├── purple.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── purple@3x.png │ │ │ ├── red.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── red@3x.png │ │ │ └── yellow.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── yellow@3x.png │ │ ├── Base.lproj │ │ │ └── LaunchScreen.storyboard │ │ ├── Info.plist │ │ ├── YPNavigationController+Configure.h │ │ ├── YPNavigationController+Configure.m │ │ └── main.m │ ├── Podfile │ ├── Podfile.lock │ └── Pods │ │ ├── Local Podspecs │ │ └── YPNavigationBarTransition.podspec.json │ │ ├── Manifest.lock │ │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ │ └── Target Support Files │ │ ├── Pods-Demo-objc │ │ ├── Info.plist │ │ ├── Pods-Demo-objc-Info.plist │ │ ├── Pods-Demo-objc-acknowledgements.markdown │ │ ├── Pods-Demo-objc-acknowledgements.plist │ │ ├── Pods-Demo-objc-dummy.m │ │ ├── Pods-Demo-objc-frameworks-Debug-input-files.xcfilelist │ │ ├── Pods-Demo-objc-frameworks-Debug-output-files.xcfilelist │ │ ├── Pods-Demo-objc-frameworks-Release-input-files.xcfilelist │ │ ├── Pods-Demo-objc-frameworks-Release-output-files.xcfilelist │ │ ├── Pods-Demo-objc-frameworks.sh │ │ ├── Pods-Demo-objc-resources.sh │ │ ├── Pods-Demo-objc-umbrella.h │ │ ├── Pods-Demo-objc.debug.xcconfig │ │ ├── Pods-Demo-objc.modulemap │ │ └── Pods-Demo-objc.release.xcconfig │ │ └── YPNavigationBarTransition │ │ ├── Info.plist │ │ ├── YPNavigationBarTransition-Info.plist │ │ ├── YPNavigationBarTransition-dummy.m │ │ ├── YPNavigationBarTransition-prefix.pch │ │ ├── YPNavigationBarTransition-umbrella.h │ │ ├── YPNavigationBarTransition.modulemap │ │ └── YPNavigationBarTransition.xcconfig ├── Demo-swift │ ├── Demo-swift.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Demo-swift.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── Demo-swift │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ ├── Contents.json │ │ │ │ ├── Icon.png │ │ │ │ ├── icon_20pt.png │ │ │ │ ├── icon_20pt@2x-1.png │ │ │ │ ├── icon_20pt@2x.png │ │ │ │ ├── icon_20pt@3x.png │ │ │ │ ├── icon_29pt.png │ │ │ │ ├── icon_29pt@2x-1.png │ │ │ │ ├── icon_29pt@2x.png │ │ │ │ ├── icon_29pt@3x.png │ │ │ │ ├── icon_40pt.png │ │ │ │ ├── icon_40pt@2x-1.png │ │ │ │ ├── icon_40pt@2x.png │ │ │ │ ├── icon_60pt@2x-1.png │ │ │ │ ├── icon_60pt@2x.png │ │ │ │ ├── icon_60pt@3x.png │ │ │ │ ├── icon_76pt.png │ │ │ │ ├── icon_76pt@2x.png │ │ │ │ └── icon_83.5@2x.png │ │ │ ├── Contents.json │ │ │ ├── blue.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── blue@3x.png │ │ │ ├── green.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── green@3x.png │ │ │ ├── purple.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── purple@3x.png │ │ │ ├── red.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── red@3x.png │ │ │ └── yellow.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── yellow@3x.png │ │ ├── Base.lproj │ │ │ └── LaunchScreen.storyboard │ │ ├── Info.plist │ │ └── YPBridge-Header.h │ ├── Podfile │ ├── Podfile.lock │ └── Pods │ │ ├── Local Podspecs │ │ └── YPNavigationBarTransition.podspec.json │ │ ├── Manifest.lock │ │ ├── Pods.xcodeproj │ │ └── project.pbxproj │ │ └── Target Support Files │ │ ├── Pods-Demo-swift │ │ ├── Info.plist │ │ ├── Pods-Demo-swift-acknowledgements.markdown │ │ ├── Pods-Demo-swift-acknowledgements.plist │ │ ├── Pods-Demo-swift-dummy.m │ │ ├── Pods-Demo-swift-frameworks.sh │ │ ├── Pods-Demo-swift-resources.sh │ │ ├── Pods-Demo-swift-umbrella.h │ │ ├── Pods-Demo-swift.debug.xcconfig │ │ ├── Pods-Demo-swift.modulemap │ │ └── Pods-Demo-swift.release.xcconfig │ │ └── YPNavigationBarTransition │ │ ├── Info.plist │ │ ├── YPNavigationBarTransition-dummy.m │ │ ├── YPNavigationBarTransition-prefix.pch │ │ ├── YPNavigationBarTransition-umbrella.h │ │ ├── YPNavigationBarTransition.modulemap │ │ └── YPNavigationBarTransition.xcconfig └── share │ ├── YPDemoConfigureViewController.h │ ├── YPDemoConfigureViewController.m │ ├── YPDemoContainerViewController.h │ ├── YPDemoContainerViewController.m │ ├── YPDemoViewController.h │ ├── YPDemoViewController.m │ ├── YPGradientDemoViewController.h │ ├── YPGradientDemoViewController.m │ ├── YPNavigationTitleLabel.h │ ├── YPNavigationTitleLabel.m │ ├── cells │ ├── YPDemoSwitchCell.h │ └── YPDemoSwitchCell.m │ └── lakeside_sunset.png ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── Podfile ├── Podfile.lock ├── README.md ├── YPNavigationBarTransition.podspec ├── YPNavigationBarTransition.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ └── contents.xcworkspacedata ├── xcshareddata │ └── xcschemes │ │ ├── YPNavigationBarTransitionLibrary.xcscheme │ │ └── YPNavigationBarTransitionTests.xcscheme └── xcuserdata │ └── yiplee.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── YPNavigationBarTransition.xcworkspace ├── contents.xcworkspacedata └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── YPNavigationBarTransition ├── Info.plist ├── UIImage+YPConfigure.h ├── UIImage+YPConfigure.m ├── UIViewController+YPNavigationBarTransition.h ├── UIViewController+YPNavigationBarTransition.m ├── YPNavigationBarProtocol.h ├── YPNavigationBarTransition.h ├── YPNavigationBarTransitionCenter.h ├── YPNavigationBarTransitionCenter.m ├── YPNavigationController.h ├── YPNavigationController.m └── internal │ ├── UINavigationBar+YPConfigure.h │ ├── UINavigationBar+YPConfigure.m │ ├── UIToolbar+YPConfigure.h │ ├── UIToolbar+YPConfigure.m │ ├── YPBarConfiguration.h │ ├── YPBarConfiguration.m │ ├── YPNavigationBarTransitionCenterInternal.h │ ├── YPNavigationControllerDelegateProxy.h │ └── YPNavigationControllerDelegateProxy.m ├── YPNavigationBarTransitionTests ├── Info.plist ├── barStyleDiffSpec.m └── objects │ ├── ColorNavigationBarStyleObject.h │ ├── ColorNavigationBarStyleObject.m │ ├── TranslucentBlackBarStyleObject.h │ └── TranslucentBlackBarStyleObject.m ├── docs └── how_to_use_CN.markdown ├── run_unit_test.sh └── screenshots ├── gif-01.gif ├── gif-02.gif └── gif-03.gif /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/objective-c,osx 3 | 4 | ### Objective-C ### 5 | # Xcode 6 | # 7 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 8 | 9 | ## Build generated 10 | build/ 11 | DerivedData/ 12 | 13 | ## Various settings 14 | *.pbxuser 15 | !default.pbxuser 16 | *.mode1v3 17 | !default.mode1v3 18 | *.mode2v3 19 | !default.mode2v3 20 | *.perspectivev3 21 | !default.perspectivev3 22 | xcuserdata/ 23 | 24 | ## Other 25 | *.moved-aside 26 | *.xccheckout 27 | *.xcscmblueprint 28 | 29 | ## Obj-C/Swift specific 30 | *.hmap 31 | *.ipa 32 | *.dSYM.zip 33 | *.dSYM 34 | 35 | # CocoaPods - Refactored to standalone file 36 | 37 | 38 | # Carthage - Refactored to standalone file 39 | 40 | # fastlane 41 | # 42 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 43 | # screenshots whenever they are needed. 44 | # For more information about the recommended setup visit: 45 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 46 | 47 | fastlane/report.xml 48 | fastlane/Preview.html 49 | fastlane/screenshots 50 | fastlane/test_output 51 | 52 | # Code Injection 53 | # 54 | # After new code Injection tools there's a generated folder /iOSInjectionProject 55 | # https://github.com/johnno1962/injectionforxcode 56 | 57 | iOSInjectionProject/ 58 | 59 | ### Objective-C Patch ### 60 | 61 | ### OSX ### 62 | *.DS_Store 63 | .AppleDouble 64 | .LSOverride 65 | 66 | # Icon must end with two \r 67 | Icon 68 | 69 | # Thumbnails 70 | ._* 71 | 72 | # Files that might appear in the root of a volume 73 | .DocumentRevisions-V100 74 | .fseventsd 75 | .Spotlight-V100 76 | .TemporaryItems 77 | .Trashes 78 | .VolumeIcon.icns 79 | .com.apple.timemachine.donotpresent 80 | 81 | # Directories potentially created on remote AFP share 82 | .AppleDB 83 | .AppleDesktop 84 | Network Trash Folder 85 | Temporary Items 86 | .apdisk 87 | 88 | # End of https://www.gitignore.io/api/objective-c,osx 89 | /Pods 90 | -------------------------------------------------------------------------------- /.slather.yml: -------------------------------------------------------------------------------- 1 | ci_service: travis_ci 2 | coverage_service: coveralls 3 | xcodeproj: YPNavigationBarTransition.xcodeproj 4 | workspace: YPNavigationBarTransition.xcworkspace 5 | scheme: YPNavigationBarTransitionLibrary 6 | source_directory: YPNavigationBarTransition 7 | ignore: 8 | - Pods/* 9 | - YPNavigationBarTransitionTests/* -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: objective-c 2 | osx_image: xcode9.2 3 | gemfile: Gemfile 4 | 5 | cache: 6 | - cocoapods 7 | - bundler 8 | 9 | script: 10 | - xcodebuild analyze test -workspace YPNavigationBarTransition.xcworkspace -scheme YPNavigationBarTransitionLibrary -sdk iphonesimulator -destination "OS=11.2,name=iPhone 8" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES ONLY_ACTIVE_ARCH=YES | bundle exec xcpretty -c 11 | - xcodebuild build -workspace YPNavigationBarTransition.xcworkspace -scheme YPNavigationBarTransition-Example -sdk iphonesimulator -destination "OS=11.2,name=iPhone 8" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c 12 | 13 | after_success: 14 | - bundle exec slather -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc.xcodeproj/xcshareddata/xcschemes/Demo-objc.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 24/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 24/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "YPDemoViewController.h" 11 | #import 12 | 13 | @interface AppDelegate () 14 | 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | CGRect frame = [UIScreen mainScreen].bounds; 22 | _window = [[UIWindow alloc] initWithFrame:frame]; 23 | 24 | UIViewController *root = [YPDemoViewController new]; 25 | UINavigationController *nav = [[YPNavigationController alloc] initWithRootViewController:root]; 26 | nav.view.backgroundColor = [UIColor whiteColor]; 27 | _window.rootViewController = nav; 28 | [_window makeKeyAndVisible]; 29 | 30 | return YES; 31 | } 32 | 33 | 34 | - (void)applicationWillResignActive:(UIApplication *)application { 35 | // 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. 36 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 37 | } 38 | 39 | 40 | - (void)applicationDidEnterBackground:(UIApplication *)application { 41 | // 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. 42 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 43 | } 44 | 45 | 46 | - (void)applicationWillEnterForeground:(UIApplication *)application { 47 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 48 | } 49 | 50 | 51 | - (void)applicationDidBecomeActive:(UIApplication *)application { 52 | // 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. 53 | } 54 | 55 | 56 | - (void)applicationWillTerminate:(UIApplication *)application { 57 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "icon_20pt@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "icon_20pt@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon_29pt@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "icon_29pt@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon_40pt@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "icon_60pt@2x-1.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "icon_60pt@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon_60pt@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "20x20", 53 | "idiom" : "ipad", 54 | "filename" : "icon_20pt.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "icon_20pt@2x-1.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "icon_29pt.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "icon_29pt@2x-1.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "icon_40pt.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "icon_40pt@2x-1.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "icon_76pt.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "icon_76pt@2x.png", 97 | "scale" : "2x" 98 | }, 99 | { 100 | "size" : "83.5x83.5", 101 | "idiom" : "ipad", 102 | "filename" : "icon_83.5@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "1024x1024", 107 | "idiom" : "ios-marketing", 108 | "filename" : "Icon.png", 109 | "scale" : "1x" 110 | } 111 | ], 112 | "info" : { 113 | "version" : 1, 114 | "author" : "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/Icon.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_20pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_20pt.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_29pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_29pt.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_40pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_40pt.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x-1.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_76pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_76pt.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/blue.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "blue@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/blue.imageset/blue@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/blue.imageset/blue@3x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/green.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "green@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/green.imageset/green@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/green.imageset/green@3x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/purple.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "purple@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/purple.imageset/purple@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/purple.imageset/purple@3x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/red.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "red@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/red.imageset/red@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/red.imageset/red@3x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/yellow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "yellow@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Assets.xcassets/yellow.imageset/yellow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-objc/Demo-objc/Assets.xcassets/yellow.imageset/yellow@3x.png -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/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 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/YPNavigationController+Configure.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPNavigationController+Configure.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 2018/4/25. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YPNavigationController (Configure) 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/YPNavigationController+Configure.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPNavigationController+Configure.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 2018/4/25. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPNavigationController+Configure.h" 10 | 11 | @implementation YPNavigationController (Configure) 12 | 13 | - (YPNavigationBarConfigurations) yp_navigtionBarConfiguration { 14 | return YPNavigationBarStyleBlack | YPNavigationBarBackgroundStyleTranslucent | YPNavigationBarBackgroundStyleNone; 15 | } 16 | 17 | - (UIColor *) yp_navigationBarTintColor { 18 | return [UIColor whiteColor]; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Demo-objc/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Demo-objc 4 | // 5 | // Created by Guoyin Lee on 2018/5/10. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '8.0' 3 | use_frameworks! 4 | 5 | target 'Demo-objc' do 6 | pod 'YPNavigationBarTransition', :path => '../../YPNavigationBarTransition.podspec' 7 | end 8 | 9 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - YPNavigationBarTransition (2.0.9) 3 | 4 | DEPENDENCIES: 5 | - YPNavigationBarTransition (from `../../YPNavigationBarTransition.podspec`) 6 | 7 | EXTERNAL SOURCES: 8 | YPNavigationBarTransition: 9 | :path: "../../YPNavigationBarTransition.podspec" 10 | 11 | SPEC CHECKSUMS: 12 | YPNavigationBarTransition: 928a8a3d944cecfd2f10a0847710384a9cdf9039 13 | 14 | PODFILE CHECKSUM: 69c4ffe249ac62559c7e1e17dca8a825dbf16040 15 | 16 | COCOAPODS: 1.8.4 17 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Local Podspecs/YPNavigationBarTransition.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "YPNavigationBarTransition", 3 | "version": "2.0.9", 4 | "summary": "A Fully functional UINavigationBar framework for making bar transition more natural!", 5 | "description": "A Fully functional UINavigationBar framework for making bar transition more natural! You don't need to call any UINavigationBar api, implementing YPNavigationBarConfigureStyle protocol for your view controller instead.", 6 | "homepage": "http://github.com/yiplee/YPNavigationBarTransition", 7 | "screenshots": [ 8 | "https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/master/screenshots/gif-01.gif", 9 | "https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/master/screenshots/gif-02.gif" 10 | ], 11 | "license": { 12 | "type": "MIT", 13 | "file": "LICENSE" 14 | }, 15 | "authors": { 16 | "yiplee": "guoyinl@gmail.com" 17 | }, 18 | "social_media_url": "https://twitter.com/yipleeyin", 19 | "platforms": { 20 | "ios": "8.0" 21 | }, 22 | "source": { 23 | "git": "https://github.com/yiplee/YPNavigationBarTransition.git", 24 | "tag": "2.0.9" 25 | }, 26 | "source_files": "YPNavigationBarTransition/**/*.{h,m}", 27 | "public_header_files": "YPNavigationBarTransition/*.h", 28 | "private_header_files": "YPNavigationBarTransition/internal/*.h", 29 | "frameworks": [ 30 | "UIKit", 31 | "Foundation" 32 | ], 33 | "requires_arc": true 34 | } 35 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - YPNavigationBarTransition (2.0.9) 3 | 4 | DEPENDENCIES: 5 | - YPNavigationBarTransition (from `../../YPNavigationBarTransition.podspec`) 6 | 7 | EXTERNAL SOURCES: 8 | YPNavigationBarTransition: 9 | :path: "../../YPNavigationBarTransition.podspec" 10 | 11 | SPEC CHECKSUMS: 12 | YPNavigationBarTransition: 928a8a3d944cecfd2f10a0847710384a9cdf9039 13 | 14 | PODFILE CHECKSUM: 69c4ffe249ac62559c7e1e17dca8a825dbf16040 15 | 16 | COCOAPODS: 1.8.4 17 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/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 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-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 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## YPNavigationBarTransition 5 | 6 | MIT License 7 | 8 | Copyright (c) 2017 yiplee 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | Generated by CocoaPods - https://cocoapods.org 29 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-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 | MIT License 18 | 19 | Copyright (c) 2017 yiplee 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | YPNavigationBarTransition 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | Generated by CocoaPods - https://cocoapods.org 49 | Title 50 | 51 | Type 52 | PSGroupSpecifier 53 | 54 | 55 | StringsTable 56 | Acknowledgements 57 | Title 58 | Acknowledgements 59 | 60 | 61 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Demo_objc : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Demo_objc 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-frameworks-Debug-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/YPNavigationBarTransition/YPNavigationBarTransition.framework -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-frameworks-Debug-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YPNavigationBarTransition.framework -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-frameworks-Release-input-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${PODS_ROOT}/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-frameworks.sh 2 | ${BUILT_PRODUCTS_DIR}/YPNavigationBarTransition/YPNavigationBarTransition.framework -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-frameworks-Release-output-files.xcfilelist: -------------------------------------------------------------------------------- 1 | ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/YPNavigationBarTransition.framework -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | set -u 4 | set -o pipefail 5 | 6 | function on_error { 7 | echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" 8 | } 9 | trap 'on_error $LINENO' ERR 10 | 11 | if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then 12 | # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy 13 | # frameworks to, so exit 0 (signalling the script phase was successful). 14 | exit 0 15 | fi 16 | 17 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 18 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 19 | 20 | COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" 21 | SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" 22 | 23 | # Used as a return value for each invocation of `strip_invalid_archs` function. 24 | STRIP_BINARY_RETVAL=0 25 | 26 | # This protects against multiple targets copying the same framework dependency at the same time. The solution 27 | # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html 28 | RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") 29 | 30 | # Copies and strips a vendored framework 31 | install_framework() 32 | { 33 | if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then 34 | local source="${BUILT_PRODUCTS_DIR}/$1" 35 | elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then 36 | local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" 37 | elif [ -r "$1" ]; then 38 | local source="$1" 39 | fi 40 | 41 | local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 42 | 43 | if [ -L "${source}" ]; then 44 | echo "Symlinked..." 45 | source="$(readlink "${source}")" 46 | fi 47 | 48 | # Use filter instead of exclude so missing patterns don't throw errors. 49 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" 50 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" 51 | 52 | local basename 53 | basename="$(basename -s .framework "$1")" 54 | binary="${destination}/${basename}.framework/${basename}" 55 | 56 | if ! [ -r "$binary" ]; then 57 | binary="${destination}/${basename}" 58 | elif [ -L "${binary}" ]; then 59 | echo "Destination binary is symlinked..." 60 | dirname="$(dirname "${binary}")" 61 | binary="${dirname}/$(readlink "${binary}")" 62 | fi 63 | 64 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 65 | if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then 66 | strip_invalid_archs "$binary" 67 | fi 68 | 69 | # Resign the code if required by the build settings to avoid unstable apps 70 | code_sign_if_enabled "${destination}/$(basename "$1")" 71 | 72 | # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. 73 | if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then 74 | local swift_runtime_libs 75 | swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) 76 | for lib in $swift_runtime_libs; do 77 | echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" 78 | rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" 79 | code_sign_if_enabled "${destination}/${lib}" 80 | done 81 | fi 82 | } 83 | 84 | # Copies and strips a vendored dSYM 85 | install_dsym() { 86 | local source="$1" 87 | if [ -r "$source" ]; then 88 | # Copy the dSYM into a the targets temp dir. 89 | 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}\"" 90 | 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}" 91 | 92 | local basename 93 | basename="$(basename -s .framework.dSYM "$source")" 94 | binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}" 95 | 96 | # Strip invalid architectures so "fat" simulator / device frameworks work on device 97 | if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then 98 | strip_invalid_archs "$binary" 99 | fi 100 | 101 | if [[ $STRIP_BINARY_RETVAL == 1 ]]; then 102 | # Move the stripped file into its final destination. 103 | 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}\"" 104 | 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}" 105 | else 106 | # 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. 107 | touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM" 108 | fi 109 | fi 110 | } 111 | 112 | # Copies the bcsymbolmap files of a vendored framework 113 | install_bcsymbolmap() { 114 | local bcsymbolmap_path="$1" 115 | local destination="${BUILT_PRODUCTS_DIR}" 116 | echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" 117 | rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" 118 | } 119 | 120 | # Signs a framework with the provided identity 121 | code_sign_if_enabled() { 122 | if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then 123 | # Use the current code_sign_identity 124 | echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" 125 | local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" 126 | 127 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 128 | code_sign_cmd="$code_sign_cmd &" 129 | fi 130 | echo "$code_sign_cmd" 131 | eval "$code_sign_cmd" 132 | fi 133 | } 134 | 135 | # Strip invalid architectures 136 | strip_invalid_archs() { 137 | binary="$1" 138 | # Get architectures for current target binary 139 | binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" 140 | # Intersect them with the architectures we are building for 141 | intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" 142 | # If there are no archs supported by this binary then warn the user 143 | if [[ -z "$intersected_archs" ]]; then 144 | echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." 145 | STRIP_BINARY_RETVAL=0 146 | return 147 | fi 148 | stripped="" 149 | for arch in $binary_archs; do 150 | if ! [[ "${ARCHS}" == *"$arch"* ]]; then 151 | # Strip non-valid architectures in-place 152 | lipo -remove "$arch" -output "$binary" "$binary" 153 | stripped="$stripped $arch" 154 | fi 155 | done 156 | if [[ "$stripped" ]]; then 157 | echo "Stripped $binary of architectures:$stripped" 158 | fi 159 | STRIP_BINARY_RETVAL=1 160 | } 161 | 162 | 163 | if [[ "$CONFIGURATION" == "Debug" ]]; then 164 | install_framework "${BUILT_PRODUCTS_DIR}/YPNavigationBarTransition/YPNavigationBarTransition.framework" 165 | fi 166 | if [[ "$CONFIGURATION" == "Release" ]]; then 167 | install_framework "${BUILT_PRODUCTS_DIR}/YPNavigationBarTransition/YPNavigationBarTransition.framework" 168 | fi 169 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 170 | wait 171 | fi 172 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-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_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc-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_Demo_objcVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_Demo_objcVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/YPNavigationBarTransition" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/YPNavigationBarTransition/YPNavigationBarTransition.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "UIKit" -framework "YPNavigationBarTransition" 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 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Demo_objc { 2 | umbrella header "Pods-Demo-objc-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/Pods-Demo-objc/Pods-Demo-objc.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/YPNavigationBarTransition" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/YPNavigationBarTransition/YPNavigationBarTransition.framework/Headers" 4 | LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' 5 | OTHER_LDFLAGS = $(inherited) -framework "Foundation" -framework "UIKit" -framework "YPNavigationBarTransition" 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 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/YPNavigationBarTransition/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 | 2.0.9 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition-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 | 2.0.9 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_YPNavigationBarTransition : NSObject 3 | @end 4 | @implementation PodsDummy_YPNavigationBarTransition 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition-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 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition-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 "UIImage+YPConfigure.h" 14 | #import "UIViewController+YPNavigationBarTransition.h" 15 | #import "YPNavigationBarProtocol.h" 16 | #import "YPNavigationBarTransition.h" 17 | #import "YPNavigationBarTransitionCenter.h" 18 | #import "YPNavigationController.h" 19 | 20 | FOUNDATION_EXPORT double YPNavigationBarTransitionVersionNumber; 21 | FOUNDATION_EXPORT const unsigned char YPNavigationBarTransitionVersionString[]; 22 | 23 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition.modulemap: -------------------------------------------------------------------------------- 1 | framework module YPNavigationBarTransition { 2 | umbrella header "YPNavigationBarTransition-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Demo-objc/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YPNavigationBarTransition 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | OTHER_LDFLAGS = $(inherited) -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}/../../.. 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES 11 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SwiftNavigationBarTransition 4 | // 5 | // Created by Guoyin Lee on 2018/5/9. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import YPNavigationBarTransition 11 | 12 | @UIApplicationMain 13 | class AppDelegate: UIResponder, UIApplicationDelegate { 14 | 15 | var window: UIWindow? 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | let frame = UIScreen.main.bounds 19 | window = UIWindow.init(frame: frame) 20 | 21 | let root = YPDemoViewController() 22 | let nav = YPNavigationController(rootViewController: root) 23 | nav.view.backgroundColor = .white 24 | 25 | window?.rootViewController = nav 26 | window?.makeKeyAndVisible() 27 | 28 | return true 29 | } 30 | } 31 | 32 | extension YPNavigationController : NavigationBarConfigureStyle { 33 | public func yp_navigtionBarConfiguration() -> YPNavigationBarConfigurations { 34 | return [.styleBlack] 35 | } 36 | 37 | public func yp_navigationBarTintColor() -> UIColor! { 38 | return .white 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "icon_20pt@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "icon_20pt@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon_29pt@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "icon_29pt@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon_40pt@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "icon_60pt@2x-1.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "icon_60pt@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon_60pt@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "20x20", 53 | "idiom" : "ipad", 54 | "filename" : "icon_20pt.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "icon_20pt@2x-1.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "icon_29pt.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "icon_29pt@2x-1.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "icon_40pt.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "icon_40pt@2x-1.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "icon_76pt.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "icon_76pt@2x.png", 97 | "scale" : "2x" 98 | }, 99 | { 100 | "size" : "83.5x83.5", 101 | "idiom" : "ipad", 102 | "filename" : "icon_83.5@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "1024x1024", 107 | "idiom" : "ios-marketing", 108 | "filename" : "Icon.png", 109 | "scale" : "1x" 110 | } 111 | ], 112 | "info" : { 113 | "version" : 1, 114 | "author" : "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/Icon.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_20pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_20pt.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_29pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_29pt.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_40pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_40pt.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x-1.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_76pt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_76pt.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/blue.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "blue@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/blue.imageset/blue@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/blue.imageset/blue@3x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/green.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "green@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/green.imageset/green@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/green.imageset/green@3x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/purple.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "purple@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/purple.imageset/purple@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/purple.imageset/purple@3x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/red.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "red@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/red.imageset/red@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/red.imageset/red@3x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/yellow.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "idiom" : "universal", 13 | "filename" : "yellow@3x.png", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Assets.xcassets/yellow.imageset/yellow@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/Demo-swift/Demo-swift/Assets.xcassets/yellow.imageset/yellow@3x.png -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/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 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIRequiredDeviceCapabilities 26 | 27 | armv7 28 | 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | 33 | UISupportedInterfaceOrientations~ipad 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationPortraitUpsideDown 37 | UIInterfaceOrientationLandscapeLeft 38 | UIInterfaceOrientationLandscapeRight 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Demo-swift/YPBridge-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPBridge-Header.h 3 | // YPNavigationBarTransition 4 | // 5 | // Created by Guoyin Lee on 2018/5/10. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | #ifndef YPBridge_Header_h 10 | #define YPBridge_Header_h 11 | 12 | #import "YPDemoViewController.h" 13 | 14 | #endif /* YPBridge_Header_h */ 15 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '8.0' 3 | use_frameworks! 4 | 5 | target 'Demo-swift' do 6 | pod 'YPNavigationBarTransition', :path => '../../YPNavigationBarTransition.podspec' 7 | end 8 | 9 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - YPNavigationBarTransition (2.0.9) 3 | 4 | DEPENDENCIES: 5 | - YPNavigationBarTransition (from `../../YPNavigationBarTransition.podspec`) 6 | 7 | EXTERNAL SOURCES: 8 | YPNavigationBarTransition: 9 | :path: "../../YPNavigationBarTransition.podspec" 10 | 11 | SPEC CHECKSUMS: 12 | YPNavigationBarTransition: 8507462c2b2b2ec088fff0f1db6da4ce96e6f7d0 13 | 14 | PODFILE CHECKSUM: 41f88db3c91b862ad4c78fa8d1ab6cd23b9cbd2c 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Local Podspecs/YPNavigationBarTransition.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "YPNavigationBarTransition", 3 | "version": "2.0.9", 4 | "summary": "A Fully functional UINavigationBar framework for making bar transition more natural!", 5 | "description": "A Fully functional UINavigationBar framework for making bar transition more natural! You don't need to call any UINavigationBar api, implementing YPNavigationBarConfigureStyle protocol for your view controller instead.", 6 | "homepage": "http://github.com/yiplee/YPNavigationBarTransition", 7 | "screenshots": [ 8 | "https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/master/screenshots/gif-01.gif", 9 | "https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/master/screenshots/gif-02.gif" 10 | ], 11 | "license": { 12 | "type": "MIT", 13 | "file": "LICENSE" 14 | }, 15 | "authors": { 16 | "yiplee": "guoyinl@gmail.com" 17 | }, 18 | "social_media_url": "https://twitter.com/yipleeyin", 19 | "platforms": { 20 | "ios": "8.0" 21 | }, 22 | "source": { 23 | "git": "https://github.com/yiplee/YPNavigationBarTransition.git", 24 | "tag": "2.0.9" 25 | }, 26 | "source_files": "YPNavigationBarTransition/**/*.{h,m}", 27 | "public_header_files": "YPNavigationBarTransition/*.h", 28 | "private_header_files": "YPNavigationBarTransition/internal/*.h", 29 | "frameworks": [ 30 | "UIKit", 31 | "Foundation" 32 | ], 33 | "requires_arc": true 34 | } 35 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - YPNavigationBarTransition (2.0.9) 3 | 4 | DEPENDENCIES: 5 | - YPNavigationBarTransition (from `../../YPNavigationBarTransition.podspec`) 6 | 7 | EXTERNAL SOURCES: 8 | YPNavigationBarTransition: 9 | :path: "../../YPNavigationBarTransition.podspec" 10 | 11 | SPEC CHECKSUMS: 12 | YPNavigationBarTransition: 8507462c2b2b2ec088fff0f1db6da4ce96e6f7d0 13 | 14 | PODFILE CHECKSUM: 41f88db3c91b862ad4c78fa8d1ab6cd23b9cbd2c 15 | 16 | COCOAPODS: 1.5.3 17 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/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 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## YPNavigationBarTransition 5 | 6 | MIT License 7 | 8 | Copyright (c) 2017 yiplee 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | 28 | Generated by CocoaPods - https://cocoapods.org 29 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift-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 | MIT License 18 | 19 | Copyright (c) 2017 yiplee 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | 39 | License 40 | MIT 41 | Title 42 | YPNavigationBarTransition 43 | Type 44 | PSGroupSpecifier 45 | 46 | 47 | FooterText 48 | Generated by CocoaPods - https://cocoapods.org 49 | Title 50 | 51 | Type 52 | PSGroupSpecifier 53 | 54 | 55 | StringsTable 56 | Acknowledgements 57 | Title 58 | Acknowledgements 59 | 60 | 61 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_Demo_swift : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_Demo_swift 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift-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 | 145 | if [[ "$CONFIGURATION" == "Debug" ]]; then 146 | install_framework "${BUILT_PRODUCTS_DIR}/YPNavigationBarTransition/YPNavigationBarTransition.framework" 147 | fi 148 | if [[ "$CONFIGURATION" == "Release" ]]; then 149 | install_framework "${BUILT_PRODUCTS_DIR}/YPNavigationBarTransition/YPNavigationBarTransition.framework" 150 | fi 151 | if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then 152 | wait 153 | fi 154 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift-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_TEMP_DIR}/assetcatalog_generated_info_cocoapods.plist" 117 | fi 118 | fi 119 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift-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_Demo_swiftVersionNumber; 15 | FOUNDATION_EXPORT const unsigned char Pods_Demo_swiftVersionString[]; 16 | 17 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift.debug.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/YPNavigationBarTransition" 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}/YPNavigationBarTransition/YPNavigationBarTransition.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "YPNavigationBarTransition" 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 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift.modulemap: -------------------------------------------------------------------------------- 1 | framework module Pods_Demo_swift { 2 | umbrella header "Pods-Demo-swift-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/Pods-Demo-swift/Pods-Demo-swift.release.xcconfig: -------------------------------------------------------------------------------- 1 | FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/YPNavigationBarTransition" 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}/YPNavigationBarTransition/YPNavigationBarTransition.framework/Headers" 5 | OTHER_LDFLAGS = $(inherited) -framework "YPNavigationBarTransition" 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 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/YPNavigationBarTransition/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 | 2.0.9 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | ${CURRENT_PROJECT_VERSION} 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_YPNavigationBarTransition : NSObject 3 | @end 4 | @implementation PodsDummy_YPNavigationBarTransition 5 | @end 6 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition-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 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition-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 "UIImage+YPConfigure.h" 14 | #import "UIViewController+YPNavigationBarTransition.h" 15 | #import "YPNavigationBarProtocol.h" 16 | #import "YPNavigationBarTransition.h" 17 | #import "YPNavigationBarTransitionCenter.h" 18 | #import "YPNavigationController.h" 19 | 20 | FOUNDATION_EXPORT double YPNavigationBarTransitionVersionNumber; 21 | FOUNDATION_EXPORT const unsigned char YPNavigationBarTransitionVersionString[]; 22 | 23 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition.modulemap: -------------------------------------------------------------------------------- 1 | framework module YPNavigationBarTransition { 2 | umbrella header "YPNavigationBarTransition-umbrella.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | -------------------------------------------------------------------------------- /Examples/Demo-swift/Pods/Target Support Files/YPNavigationBarTransition/YPNavigationBarTransition.xcconfig: -------------------------------------------------------------------------------- 1 | CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YPNavigationBarTransition 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}/../../.. 8 | PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} 9 | SKIP_INSTALL = YES 10 | -------------------------------------------------------------------------------- /Examples/share/YPDemoConfigureViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPDemoConfigureViewController.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 25/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YPDemoConfigureViewController : UIViewController 12 | 13 | @property (nonatomic, strong, readonly) UITableView *tableView; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/share/YPDemoConfigureViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPDemoConfigureViewController.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 25/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPDemoConfigureViewController.h" 10 | #import "YPDemoContainerViewController.h" 11 | #import "YPGradientDemoViewController.h" 12 | 13 | #import "YPDemoSwitchCell.h" 14 | #import "UIImage+YPConfigure.h" 15 | 16 | #import 17 | 18 | @interface YPDemoConfigureViewController () 19 | < 20 | UITableViewDelegate, 21 | UITableViewDataSource 22 | > 23 | 24 | @property (nonatomic, strong, readwrite) UITableView *tableView; 25 | 26 | @end 27 | 28 | @implementation YPDemoConfigureViewController { 29 | BOOL _barHidden; 30 | BOOL _transparent; 31 | BOOL _translucent; 32 | BOOL _shadowImage; 33 | UIBarStyle _barStyle; 34 | 35 | NSArray *_colors; 36 | NSArray *_imageNames; 37 | } 38 | 39 | - (void) loadView { 40 | [super loadView]; 41 | 42 | _tableView = [[UITableView alloc] initWithFrame:self.view.bounds 43 | style:UITableViewStyleGrouped]; 44 | _tableView.delegate = self; 45 | _tableView.dataSource = self; 46 | self.view = _tableView; 47 | } 48 | 49 | - (void)viewDidLoad { 50 | [super viewDidLoad]; 51 | 52 | [_tableView registerClass:[YPDemoSwitchCell class] forCellReuseIdentifier:@"switch"]; 53 | [_tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"action"]; 54 | 55 | _translucent = NO; 56 | _barStyle = UIBarStyleBlack; 57 | 58 | _colors = @[ 59 | @{@"None" : [NSNull null]}, 60 | @{@"Black" : [UIColor blackColor]}, 61 | @{@"White" : [UIColor whiteColor]}, 62 | @{@"TableView Background Color" : _tableView.backgroundColor}, 63 | @{@"Red" : [UIColor redColor]} 64 | ]; 65 | 66 | _imageNames = @[@"green", 67 | @"blue", 68 | @"purple", 69 | @"red", 70 | @"yellow"]; 71 | } 72 | 73 | - (void) showNextViewControllerWithColor:(UIColor *)color { 74 | YPDemoContainerViewController *controller = [YPDemoContainerViewController new]; 75 | controller.title = @"Color"; 76 | 77 | YPNavigationBarConfigurations conf = YPNavigationBarConfigurationsDefault; 78 | if (_barHidden) { 79 | conf |= YPNavigationBarHidden; 80 | } 81 | 82 | if (_transparent) { 83 | conf |= YPNavigationBarBackgroundStyleTransparent; 84 | } else if (!_translucent) { 85 | conf |= YPNavigationBarBackgroundStyleOpaque; 86 | } 87 | 88 | if (_barStyle == UIBarStyleBlack) { 89 | conf |= YPNavigationBarStyleBlack; 90 | } 91 | 92 | if (_shadowImage) { 93 | conf |= YPNavigationBarShowShadowImage; 94 | } 95 | 96 | if (color) conf |= YPNavigationBarBackgroundStyleColor; 97 | 98 | controller.configurations = conf; 99 | controller.backgroundColor = color; 100 | 101 | [self.navigationController pushViewController:controller animated:YES]; 102 | } 103 | 104 | - (void) showNextViewControllerWithBackgroundImageName:(NSString *)imageName { 105 | YPDemoContainerViewController *controller = [YPDemoContainerViewController new]; 106 | controller.title = imageName; 107 | 108 | YPNavigationBarConfigurations conf = YPNavigationBarConfigurationsDefault; 109 | if (_barHidden) { 110 | conf |= YPNavigationBarHidden; 111 | } 112 | 113 | if (_transparent) { 114 | conf |= YPNavigationBarBackgroundStyleTransparent; 115 | } else if (!_translucent) { 116 | conf |= YPNavigationBarBackgroundStyleOpaque; 117 | } 118 | 119 | if (_barStyle == UIBarStyleBlack) { 120 | conf |= YPNavigationBarStyleBlack; 121 | } 122 | 123 | if (_shadowImage) { 124 | conf |= YPNavigationBarShowShadowImage; 125 | } 126 | 127 | conf |= YPNavigationBarBackgroundStyleImage; 128 | 129 | controller.configurations = conf; 130 | controller.backgroundImage = [[UIImage imageNamed:imageName] resizableImageWithCapInsets:UIEdgeInsetsZero 131 | resizingMode:UIImageResizingModeStretch]; 132 | controller.backgroundImageName = imageName; 133 | 134 | [self.navigationController pushViewController:controller animated:YES]; 135 | } 136 | 137 | - (void) switchValueChanged:(UISwitch *)sender { 138 | NSInteger const tag = sender.tag; 139 | if (tag == 0) { 140 | _barHidden = sender.isOn; 141 | } else if (tag == 1) { 142 | _transparent = sender.isOn; 143 | 144 | if (_transparent && _barStyle != UIBarStyleDefault) { 145 | // 为了更好的 demo 展示效果 146 | // bar 全透明之后把 barStyle 设置成 UIBarStyleDefault 147 | _barStyle = UIBarStyleDefault; 148 | 149 | NSIndexPath *barStyleIndexPath = [NSIndexPath indexPathForRow:3 inSection:0]; 150 | YPDemoSwitchCell *cell = [_tableView cellForRowAtIndexPath:barStyleIndexPath]; 151 | [cell.switcher setOn:NO animated:YES]; 152 | } 153 | } else if (tag == 2) { 154 | _translucent = sender.isOn; 155 | } else if (tag == 3) { 156 | _barStyle = sender.isOn ? UIBarStyleBlack : UIBarStyleDefault; 157 | } else { 158 | _shadowImage = sender.isOn; 159 | } 160 | } 161 | 162 | #pragma mark - UITableViewDataSource 163 | 164 | - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView { 165 | return 4; 166 | } 167 | 168 | - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 169 | if (section == 0) return 5; 170 | else if (section == 1) return _colors.count; 171 | else if (section == 2) return _imageNames.count; 172 | else if (section == 3) return 1; 173 | else return 0; 174 | } 175 | 176 | - (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 177 | NSInteger const section = indexPath.section; 178 | NSInteger const row = indexPath.row; 179 | 180 | if (section == 0) { 181 | YPDemoSwitchCell *cell = [tableView dequeueReusableCellWithIdentifier:@"switch" 182 | forIndexPath:indexPath]; 183 | NSString *title = nil; 184 | BOOL isOn = NO; 185 | 186 | if (row == 0) { 187 | title = @"Hidden"; 188 | isOn = _barHidden; 189 | } else if (row == 1) { 190 | title = @"Transparent"; 191 | isOn = _transparent; 192 | } else if (row == 2) { 193 | title = @"Translucent"; 194 | isOn = _translucent; 195 | } else if (row == 3) { 196 | title = @"Black Bar Style"; 197 | isOn = _barStyle == UIBarStyleBlack; 198 | } else { 199 | title = @"Shadow Image"; 200 | isOn = _shadowImage; 201 | } 202 | 203 | cell.textLabel.text = title; 204 | cell.switcher.on = isOn; 205 | 206 | cell.switcher.tag = row; 207 | [cell.switcher addTarget:self 208 | action:@selector(switchValueChanged:) 209 | forControlEvents:UIControlEventValueChanged]; 210 | return cell; 211 | } else { 212 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"action" 213 | forIndexPath:indexPath]; 214 | UIImage *image = nil; 215 | NSString *title = nil; 216 | 217 | if (section == 1) { // colors 218 | NSDictionary *color = _colors[row]; 219 | title = color.allKeys.firstObject; 220 | id c = color.allValues.firstObject; 221 | if (c == [NSNull null]) { 222 | c = [UIColor clearColor]; 223 | } 224 | 225 | image = [UIImage yp_imageWithColor:c size:CGSizeMake(32, 32)]; 226 | } else if (section == 2) { // images 227 | title = _imageNames[row]; 228 | image = [UIImage imageNamed:title]; 229 | } else if (section == 3) { 230 | title = @"Dynamic Gradient Bar"; 231 | } 232 | 233 | cell.imageView.image = image; 234 | cell.textLabel.text = title; 235 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 236 | return cell; 237 | } 238 | } 239 | 240 | - (NSString *) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 241 | if (section == 0) return @"Next Controller Bar Style"; 242 | else if (section == 1) return @"Colors"; 243 | else if (section == 2) return @"Images"; 244 | else return nil; 245 | } 246 | 247 | - (NSString *) tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section { 248 | if (section == 0) { 249 | return 250 | @"bar style 会影响状态栏的样式\n" 251 | "bar style 是 UIBarStyleBlack 的时候状态栏为白色\n" 252 | "bar style 是 UIBarStyleDefault 的时候状态栏为黑色"; 253 | } else if (section == 1) { 254 | return @"选择偏白的颜色的时候,关闭 Black Bar Style 展示效果更好"; 255 | } else if (section == 2) { 256 | return @"选择图片为背景的时候建议关掉半透明效果"; 257 | } else if (section == 3) { 258 | return @"style 根据页面滑动距离动态改变"; 259 | } 260 | 261 | return nil; 262 | } 263 | 264 | #pragma mark - UITableViewDelegate 265 | 266 | - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 267 | return 44; 268 | } 269 | 270 | - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 271 | NSInteger const section = indexPath.section; 272 | NSInteger const row = indexPath.row; 273 | 274 | if (section == 1) { 275 | id color = _colors[row].allValues.firstObject; 276 | if (color == [NSNull null]) color = nil; 277 | [self showNextViewControllerWithColor:color]; 278 | } else if (section == 2) { 279 | NSString *imageName = _imageNames[row]; 280 | [self showNextViewControllerWithBackgroundImageName:imageName]; 281 | } else if (section == 3) { 282 | YPGradientDemoViewController *demo = [YPGradientDemoViewController new]; 283 | [self.navigationController pushViewController:demo animated:YES]; 284 | } 285 | 286 | [tableView deselectRowAtIndexPath:indexPath animated:NO]; 287 | } 288 | 289 | @end 290 | -------------------------------------------------------------------------------- /Examples/share/YPDemoContainerViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPDemoContainerViewController.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 25/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface YPDemoContainerViewController : UIViewController 13 | 14 | @property (nonatomic, assign) YPNavigationBarConfigurations configurations; 15 | @property (nonatomic, strong) UIColor *tintColor; 16 | @property (nonatomic, strong) UIColor *backgroundColor; 17 | @property (nonatomic, strong) UIImage *backgroundImage; 18 | @property (nonatomic, copy) NSString *backgroundImageName; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Examples/share/YPDemoContainerViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPDemoContainerViewController.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 25/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPDemoContainerViewController.h" 10 | #import "YPDemoConfigureViewController.h" 11 | #import "YPNavigationTitleLabel.h" 12 | 13 | @interface YPDemoContainerViewController () 14 | 15 | @end 16 | 17 | @implementation YPDemoContainerViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | self.extendedLayoutIncludesOpaqueBars = YES; 23 | 24 | YPDemoConfigureViewController *conf = [YPDemoConfigureViewController new]; 25 | [self addChildViewController:conf]; 26 | 27 | UIView *confView = conf.view; 28 | confView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 29 | confView.frame = self.view.bounds; 30 | [self.view addSubview:confView]; 31 | [conf didMoveToParentViewController:self]; 32 | 33 | YPNavigationTitleLabel *titleView = nil; 34 | if ([self.navigationItem.titleView isKindOfClass:YPNavigationTitleLabel.class]) { 35 | titleView = (YPNavigationTitleLabel *)self.navigationItem.titleView; 36 | } 37 | titleView.textColor = self.configurations & YPNavigationBarStyleBlack ? [UIColor whiteColor] : [UIColor blackColor]; 38 | 39 | UIBarButtonItem *popToRoot = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop 40 | target:self 41 | action:@selector(popToRoot:)]; 42 | self.navigationItem.rightBarButtonItem = popToRoot; 43 | } 44 | 45 | - (void) setTitle:(NSString *)title { 46 | [super setTitle:title]; 47 | 48 | YPNavigationTitleLabel *titleView = nil; 49 | if ([self.navigationItem.titleView isKindOfClass:YPNavigationTitleLabel.class]) { 50 | titleView = (YPNavigationTitleLabel *)self.navigationItem.titleView; 51 | } 52 | 53 | if (!titleView) { 54 | titleView = [YPNavigationTitleLabel new]; 55 | } 56 | 57 | titleView.text = title; 58 | [titleView sizeToFit]; 59 | self.navigationItem.titleView = titleView; 60 | } 61 | 62 | - (void) popToRoot:(id)sender { 63 | [self.navigationController popToRootViewControllerAnimated:YES]; 64 | } 65 | 66 | #pragma mark - YPNavigationBarConfigureStyle 67 | 68 | - (YPNavigationBarConfigurations) yp_navigtionBarConfiguration { 69 | return _configurations; 70 | } 71 | 72 | - (UIColor *) yp_navigationBarTintColor { 73 | return _tintColor; 74 | } 75 | 76 | - (UIColor *) yp_navigationBackgroundColor { 77 | return _backgroundColor; 78 | } 79 | 80 | - (UIImage *) yp_navigationBackgroundImageWithIdentifier:(NSString *__autoreleasing *)identifier { 81 | if (identifier) *identifier = _backgroundImageName; 82 | return _backgroundImage; 83 | } 84 | 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /Examples/share/YPDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPDemoViewController.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 25/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YPDemoViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/share/YPDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPDemoViewController.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 25/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPDemoViewController.h" 10 | #import "YPDemoConfigureViewController.h" 11 | #import "YPNavigationTitleLabel.h" 12 | 13 | @implementation YPDemoViewController 14 | 15 | - (void) viewDidLoad { 16 | [super viewDidLoad]; 17 | self.view.backgroundColor = [UIColor whiteColor]; 18 | 19 | self.title = @"YPNavigationBarTransition"; 20 | self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Back" 21 | style:UIBarButtonItemStylePlain 22 | target:nil 23 | action:nil]; 24 | 25 | YPDemoConfigureViewController *conf = [YPDemoConfigureViewController new]; 26 | [self addChildViewController:conf]; 27 | 28 | UIView *confView = conf.view; 29 | confView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 30 | confView.frame = self.view.bounds; 31 | [self.view addSubview:confView]; 32 | [conf didMoveToParentViewController:self]; 33 | 34 | UIBarButtonItem *shareButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction 35 | target:self 36 | action:@selector(shareAction:)]; 37 | self.navigationItem.rightBarButtonItem = shareButton; 38 | 39 | YPNavigationTitleLabel *titleView = [YPNavigationTitleLabel new]; 40 | titleView.text = self.title; 41 | [titleView sizeToFit]; 42 | self.navigationItem.titleView = titleView; 43 | } 44 | 45 | - (void) shareAction:(id)sender { 46 | NSString *const githubLink = @"https://github.com/yiplee/YPNavigationBarTransition"; 47 | NSURL *shareURL = [NSURL URLWithString:githubLink]; 48 | UIActivityViewController *share = [[UIActivityViewController alloc] initWithActivityItems:@[shareURL] 49 | applicationActivities:nil]; 50 | share.popoverPresentationController.barButtonItem = sender; 51 | [self presentViewController:share animated:YES completion:nil]; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Examples/share/YPGradientDemoViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPGradientDemoViewController.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Li Guoyin on 2017/12/30. 6 | // Copyright © 2017年 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface YPGradientDemoViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /Examples/share/YPGradientDemoViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPGradientDemoViewController.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Li Guoyin on 2017/12/30. 6 | // Copyright © 2017年 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPGradientDemoViewController.h" 10 | #import "YPNavigationTitleLabel.h" 11 | #import "YPDemoConfigureViewController.h" 12 | 13 | @interface YPGradientDemoViewController () 14 | 15 | @property (nonatomic, strong) YPDemoConfigureViewController *configureController; 16 | @property (nonatomic, strong) YPNavigationTitleLabel *titleLabel; 17 | @property (nonatomic, strong) UIImageView *headerView; 18 | 19 | @end 20 | 21 | @implementation YPGradientDemoViewController { 22 | CGFloat _gradientProgress; 23 | } 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | 28 | self.title = @"Dynamic Gradient Bar"; 29 | 30 | _titleLabel = [YPNavigationTitleLabel new]; 31 | _titleLabel.textColor = [UIColor clearColor]; 32 | _titleLabel.text = self.title; 33 | self.navigationItem.titleView = _titleLabel; 34 | 35 | self.extendedLayoutIncludesOpaqueBars = YES; 36 | 37 | _configureController = [YPDemoConfigureViewController new]; 38 | [self addChildViewController:_configureController]; 39 | 40 | UIView *confView = _configureController.view; 41 | confView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 42 | confView.frame = self.view.bounds; 43 | [self.view addSubview:confView]; 44 | [_configureController didMoveToParentViewController:self]; 45 | 46 | UITableView *tableView = _configureController.tableView; 47 | tableView.delegate = self; 48 | 49 | if (@available(iOS 11,*)) { 50 | tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; 51 | } else { 52 | self.automaticallyAdjustsScrollViewInsets = NO; 53 | } 54 | 55 | NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"lakeside_sunset" ofType:@"png"]; 56 | UIImage *headerImage = [UIImage imageWithContentsOfFile:imagePath]; 57 | _headerView = [[UIImageView alloc] initWithImage:headerImage]; 58 | _headerView.clipsToBounds = YES; 59 | _headerView.contentMode = UIViewContentModeScaleAspectFill; 60 | [self.view insertSubview:_headerView aboveSubview:tableView]; 61 | 62 | UIBarButtonItem *popToRoot = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop 63 | target:self 64 | action:@selector(popToRoot:)]; 65 | self.navigationItem.rightBarButtonItem = popToRoot; 66 | } 67 | 68 | - (void) viewDidLayoutSubviews { 69 | [super viewDidLayoutSubviews]; 70 | 71 | UITableView *tableView = self.configureController.tableView; 72 | UIImageView *headerView = self.headerView; 73 | 74 | CGFloat width = CGRectGetWidth(self.view.bounds); 75 | UIImage *headerImage = headerView.image; 76 | CGFloat imageHeight = headerImage.size.height / headerImage.size.width * width; 77 | CGRect headerFrame = headerView.frame; 78 | 79 | if (tableView.contentInset.top == 0) { 80 | UIEdgeInsets inset = UIEdgeInsetsZero; 81 | if (@available(iOS 11,*)) { 82 | inset.bottom = self.view.safeAreaInsets.bottom; 83 | } 84 | tableView.scrollIndicatorInsets = inset; 85 | inset.top = imageHeight; 86 | tableView.contentInset = inset; 87 | 88 | tableView.contentOffset = CGPointMake(0, -inset.top); 89 | } 90 | 91 | if (CGRectGetHeight(headerFrame) != imageHeight) { 92 | headerView.frame = [self headerImageFrame]; 93 | } 94 | } 95 | 96 | - (CGRect) headerImageFrame { 97 | UITableView *tableView = self.configureController.tableView; 98 | UIImageView *headerView = self.headerView; 99 | 100 | CGFloat width = CGRectGetWidth(self.view.bounds); 101 | UIImage *headerImage = headerView.image; 102 | CGFloat imageHeight = headerImage.size.height / headerImage.size.width * width; 103 | 104 | CGFloat contentOffsetY = tableView.contentOffset.y + tableView.contentInset.top; 105 | if (contentOffsetY < 0) { 106 | imageHeight += -contentOffsetY; 107 | } 108 | 109 | CGRect headerFrame = self.view.bounds; 110 | if (contentOffsetY > 0) { 111 | headerFrame.origin.y -= contentOffsetY; 112 | } 113 | headerFrame.size.height = imageHeight; 114 | 115 | return headerFrame; 116 | } 117 | 118 | - (void) popToRoot:(id)sender { 119 | [self.navigationController popToRootViewControllerAnimated:YES]; 120 | } 121 | 122 | #pragma mark - UITableViewDelegate 123 | 124 | - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 125 | id delegate = (id)self.configureController; 126 | return [delegate tableView:tableView heightForRowAtIndexPath:indexPath]; 127 | } 128 | 129 | - (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 130 | id delegate = (id)self.configureController; 131 | [delegate tableView:tableView didSelectRowAtIndexPath:indexPath]; 132 | } 133 | 134 | - (void) scrollViewDidScroll:(UIScrollView *)scrollView { 135 | CGFloat headerHeight = CGRectGetHeight(self.headerView.frame); 136 | if (@available(iOS 11,*)) { 137 | headerHeight -= self.view.safeAreaInsets.top; 138 | } else { 139 | headerHeight -= [self.topLayoutGuide length]; 140 | } 141 | 142 | CGFloat progress = scrollView.contentOffset.y + scrollView.contentInset.top; 143 | CGFloat gradientProgress = MIN(1, MAX(0, progress / headerHeight)); 144 | gradientProgress = gradientProgress * gradientProgress * gradientProgress * gradientProgress; 145 | if (gradientProgress != _gradientProgress) { 146 | _gradientProgress = gradientProgress; 147 | self.titleLabel.textColor = _gradientProgress == 1 ? [self yp_navigationBarTintColor] : [UIColor clearColor]; 148 | [self yp_refreshNavigationBarStyle]; 149 | } 150 | 151 | self.headerView.frame = [self headerImageFrame]; 152 | } 153 | 154 | #pragma mark - YPNavigationBarConfigureStyle 155 | 156 | - (YPNavigationBarConfigurations) yp_navigtionBarConfiguration { 157 | YPNavigationBarConfigurations configurations = YPNavigationBarShow; 158 | if (@available(iOS 13.0, *)) { 159 | if (_gradientProgress <= 0) { 160 | configurations |= YPNavigationBarBackgroundStyleTransparent; 161 | } else { 162 | configurations |= YPNavigationBarBackgroundStyleOpaque; 163 | configurations |= YPNavigationBarBackgroundStyleColor; 164 | } 165 | } else { 166 | if (_gradientProgress < 0.5) { 167 | configurations |= YPNavigationBarStyleBlack; 168 | } 169 | 170 | if (_gradientProgress == 1) { 171 | configurations |= YPNavigationBarBackgroundStyleOpaque; 172 | } 173 | 174 | configurations |= YPNavigationBarBackgroundStyleColor; 175 | } 176 | return configurations; 177 | } 178 | 179 | - (UIColor *) yp_navigationBarTintColor { 180 | return [UIColor colorWithWhite:1 - _gradientProgress alpha:1]; 181 | } 182 | 183 | - (UIColor *) yp_navigationBackgroundColor { 184 | return [UIColor colorWithWhite:1 alpha:_gradientProgress]; 185 | } 186 | 187 | @end 188 | -------------------------------------------------------------------------------- /Examples/share/YPNavigationTitleLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPNavigationTitleLabel.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Li Guoyin on 2017/12/26. 6 | // Copyright © 2017年 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YPNavigationTitleLabel : UILabel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Examples/share/YPNavigationTitleLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPNavigationTitleLabel.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Li Guoyin on 2017/12/26. 6 | // Copyright © 2017年 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPNavigationTitleLabel.h" 10 | 11 | @implementation YPNavigationTitleLabel 12 | 13 | - (instancetype) initWithFrame:(CGRect)frame { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | self.font = [UIFont systemFontOfSize:16 weight:UIFontWeightSemibold]; 17 | self.textAlignment = NSTextAlignmentCenter; 18 | self.textColor = [UIColor whiteColor]; 19 | } 20 | 21 | return self; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Examples/share/cells/YPDemoSwitchCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPDemoSwitchCell.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 26/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YPDemoSwitchCell : UITableViewCell 12 | 13 | @property (nonatomic, strong, readonly) UISwitch *switcher; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Examples/share/cells/YPDemoSwitchCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPDemoSwitchCell.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 26/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPDemoSwitchCell.h" 10 | 11 | @implementation YPDemoSwitchCell 12 | 13 | - (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { 14 | self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier]; 15 | if (self) { 16 | self.selectionStyle = UITableViewCellSelectionStyleNone; 17 | self.accessoryType = UITableViewCellAccessoryNone; 18 | 19 | _switcher = [UISwitch new]; 20 | self.accessoryView = _switcher; 21 | } 22 | 23 | return self; 24 | } 25 | 26 | - (void) prepareForReuse { 27 | [super prepareForReuse]; 28 | 29 | _switcher.on = NO; 30 | [_switcher removeTarget:nil 31 | action:nil 32 | forControlEvents:UIControlEventValueChanged]; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Examples/share/lakeside_sunset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/Examples/share/lakeside_sunset.png -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'cocoapods', '1.5.3' 4 | gem 'slather', '~> 2.4.0' 5 | gem 'xcpretty', '0.2.4' -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (2.3.6) 5 | activesupport (4.2.10) 6 | i18n (~> 0.7) 7 | minitest (~> 5.1) 8 | thread_safe (~> 0.3, >= 0.3.4) 9 | tzinfo (~> 1.1) 10 | atomos (0.1.3) 11 | claide (1.0.2) 12 | clamp (0.6.5) 13 | cocoapods (1.5.3) 14 | activesupport (>= 4.0.2, < 5) 15 | claide (>= 1.0.2, < 2.0) 16 | cocoapods-core (= 1.5.3) 17 | cocoapods-deintegrate (>= 1.0.2, < 2.0) 18 | cocoapods-downloader (>= 1.2.0, < 2.0) 19 | cocoapods-plugins (>= 1.0.0, < 2.0) 20 | cocoapods-search (>= 1.0.0, < 2.0) 21 | cocoapods-stats (>= 1.0.0, < 2.0) 22 | cocoapods-trunk (>= 1.3.0, < 2.0) 23 | cocoapods-try (>= 1.1.0, < 2.0) 24 | colored2 (~> 3.1) 25 | escape (~> 0.0.4) 26 | fourflusher (~> 2.0.1) 27 | gh_inspector (~> 1.0) 28 | molinillo (~> 0.6.5) 29 | nap (~> 1.0) 30 | ruby-macho (~> 1.1) 31 | xcodeproj (>= 1.5.7, < 2.0) 32 | cocoapods-core (1.5.3) 33 | activesupport (>= 4.0.2, < 6) 34 | fuzzy_match (~> 2.0.4) 35 | nap (~> 1.0) 36 | cocoapods-deintegrate (1.0.2) 37 | cocoapods-downloader (1.6.3) 38 | cocoapods-plugins (1.0.0) 39 | nap 40 | cocoapods-search (1.0.0) 41 | cocoapods-stats (1.0.0) 42 | cocoapods-trunk (1.3.1) 43 | nap (>= 0.8, < 2.0) 44 | netrc (~> 0.11) 45 | cocoapods-try (1.1.0) 46 | colored2 (3.1.2) 47 | concurrent-ruby (1.0.5) 48 | escape (0.0.4) 49 | fourflusher (2.0.1) 50 | fuzzy_match (2.0.4) 51 | gh_inspector (1.1.3) 52 | i18n (0.9.5) 53 | concurrent-ruby (~> 1.0) 54 | mini_portile2 (2.3.0) 55 | minitest (5.11.3) 56 | molinillo (0.6.6) 57 | nanaimo (0.2.6) 58 | nap (1.1.0) 59 | netrc (0.11.0) 60 | nokogiri (1.8.5) 61 | mini_portile2 (~> 2.3.0) 62 | rouge (1.11.1) 63 | ruby-macho (1.2.0) 64 | slather (2.4.6) 65 | CFPropertyList (~> 2.2) 66 | activesupport (>= 4.0.2) 67 | clamp (~> 0.6) 68 | nokogiri (~> 1.8.2) 69 | xcodeproj (~> 1.4) 70 | thread_safe (0.3.6) 71 | tzinfo (1.2.5) 72 | thread_safe (~> 0.1) 73 | xcodeproj (1.6.0) 74 | CFPropertyList (>= 2.3.3, < 4.0) 75 | atomos (~> 0.1.3) 76 | claide (>= 1.0.2, < 2.0) 77 | colored2 (~> 3.1) 78 | nanaimo (~> 0.2.6) 79 | xcpretty (0.2.4) 80 | rouge (~> 1.8) 81 | 82 | PLATFORMS 83 | ruby 84 | 85 | DEPENDENCIES 86 | cocoapods (= 1.5.3) 87 | slather (~> 2.4.0) 88 | xcpretty (= 0.2.4) 89 | 90 | BUNDLED WITH 91 | 1.16.2 92 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 yiplee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | platform :ios, '8.0' 3 | use_frameworks! 4 | 5 | target 'YPNavigationBarTransitionTests' do 6 | pod 'Kiwi', :inhibit_warnings => true 7 | end 8 | 9 | -------------------------------------------------------------------------------- /Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Kiwi (2.4.0) 3 | 4 | DEPENDENCIES: 5 | - Kiwi 6 | 7 | SPEC REPOS: 8 | https://github.com/cocoapods/specs.git: 9 | - Kiwi 10 | 11 | SPEC CHECKSUMS: 12 | Kiwi: f49c9d54b28917df5928fe44968a39ed198cb8a8 13 | 14 | PODFILE CHECKSUM: cc67ff09cb9339e0ee42d87c7af45db04b395224 15 | 16 | COCOAPODS: 1.6.1 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YPNavigationBarTransition 2 | 3 |

4 | 5 | Build Status 7 | 8 | 9 | Pods Version 11 | 12 | 15 | 16 | Carthage Compatible 18 | 19 |

20 | 21 | A Fully functional `UINavigationBar` framework for making bar transition more natural! You don't need to call any `UINavigationBar` api, implementing `YPNavigationBarConfigureStyle` protocol for your view controller instead. 22 | 23 | 类似微信 UINavigationBar 效果的切换方案,支持任意透明半透明图片背景等等不同样式的 UINavigationBar 的切换。 24 | 25 | ## features 26 | 27 | - Transparent & translucent navigation bar 支持不透明、全透明和半透明的 navigation bar 28 | - Pure color bar 支持设置 navigation bar 背景颜色 29 | - Background image bar 支持设置 navigation bar 背景图片 30 | - Update navigationBar style **dynamicly** 可以动态调整 navigation bar 样式 31 | - Written in Objective-C with full Swift interop support 32 | 33 | ### 不同颜色和透明度的 bar 之间的切换 34 | 35 |

36 | 37 | 38 | 39 |

40 | 41 | ### 图片背景的 navigation bar 42 | 43 |

44 | 45 | 46 | 47 |

48 | 49 | ### 动态调整 navigation bar 样式 50 | 51 |

52 | 53 | 54 | 55 |

56 | 57 | ## Requirements 58 | 59 | - Xcode 9.0+ 60 | - iOS 8.0+ 61 | 62 | ## Installation 63 | 64 | ### CocoaPods 65 | 66 | The preferred installation method is with [CocoaPods](https://cocoapods.org). Add the following to your `Podfile`: 67 | 68 | ```ruby 69 | # use_frameworks! is needed for swift projects 70 | use_frameworks! 71 | pod 'YPNavigationBarTransition', '~> 2.0' 72 | ``` 73 | 74 | ### Carthage 75 | 76 | For [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`: 77 | 78 | ```ruby 79 | github "yiplee/YPNavigationBarTransition" ~> 2.0 80 | ``` 81 | 82 | ## Getting Started 83 | 84 | ### 1. Import Framework 85 | 86 | ```objc 87 | // objc 88 | #import 89 | ``` 90 | 91 | ```swift 92 | // swift 93 | import YPNavigationBarTransition 94 | ``` 95 | 96 | ### 2. Replace UINavigationController with YPNavigationController 97 | 98 | ### 3. Implement Protocol YPNavigationBarConfigureStyle for YPNavigationController in Category 99 | 100 | ```objc 101 | // objc (this will be your app's default navigationbar style) 102 | @implementation YPNavigationController (Configure) 103 | 104 | - (YPNavigationBarConfigurations) yp_navigtionBarConfiguration { 105 | return YPNavigationBarStyleBlack | YPNavigationBarBackgroundStyleTranslucent | YPNavigationBarBackgroundStyleNone; 106 | } 107 | 108 | - (UIColor *) yp_navigationBarTintColor { 109 | return [UIColor whiteColor]; 110 | } 111 | ``` 112 | 113 | ```swift 114 | // swift (this will be your app's default navigationbar style) 115 | extension YPNavigationController : NavigationBarConfigureStyle { 116 | public func yp_navigtionBarConfiguration() -> YPNavigationBarConfigurations { 117 | return [.styleBlack] 118 | } 119 | 120 | public func yp_navigationBarTintColor() -> UIColor! { 121 | return UIColor.white 122 | } 123 | } 124 | ``` 125 | 126 | - [example projects](https://github.com/yiplee/YPNavigationBarTransition/tree/master/Examples) 127 | - [How To Use 中文](https://github.com/yiplee/YPNavigationBarTransition/blob/master/docs/how_to_use_CN.markdown) 128 | 129 | ## License 130 | 131 | MIT. See the [LICENSE](LICENSE) file for details. 132 | 133 | -------------------------------------------------------------------------------- /YPNavigationBarTransition.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | 3 | 4 | s.name = "YPNavigationBarTransition" 5 | s.version = "2.2.2" 6 | s.summary = "A Fully functional UINavigationBar framework for making bar transition more natural!" 7 | s.description = "A Fully functional UINavigationBar framework for making bar transition more natural! You don't need to call any UINavigationBar api, implementing YPNavigationBarConfigureStyle protocol for your view controller instead." 8 | 9 | s.homepage = "http://github.com/yiplee/YPNavigationBarTransition" 10 | s.screenshots = "https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/master/screenshots/gif-01.gif", "https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/master/screenshots/gif-02.gif" 11 | 12 | s.license = { :type => "MIT", :file => "LICENSE" } 13 | 14 | s.author = { "yiplee" => "guoyinl@gmail.com" } 15 | s.social_media_url = "https://twitter.com/yipleeyin" 16 | 17 | # s.platform = :ios 18 | s.platform = :ios, "8.0" 19 | 20 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 21 | # 22 | # Specify the location from where the source should be retrieved. 23 | # Supports git, hg, bzr, svn and HTTP. 24 | # 25 | 26 | s.source = { :git => "https://github.com/yiplee/YPNavigationBarTransition.git", :tag => s.version.to_s} 27 | 28 | s.source_files = "YPNavigationBarTransition/**/*.{h,m}" 29 | s.public_header_files = 'YPNavigationBarTransition/*.h' 30 | s.private_header_files = "YPNavigationBarTransition/internal/*.h" 31 | 32 | s.frameworks = "UIKit" ,"Foundation" 33 | s.requires_arc = true 34 | 35 | end 36 | -------------------------------------------------------------------------------- /YPNavigationBarTransition.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /YPNavigationBarTransition.xcodeproj/xcshareddata/xcschemes/YPNavigationBarTransitionLibrary.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 34 | 40 | 41 | 42 | 43 | 44 | 50 | 51 | 52 | 53 | 54 | 55 | 65 | 66 | 72 | 73 | 74 | 75 | 76 | 77 | 83 | 84 | 90 | 91 | 92 | 93 | 95 | 96 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /YPNavigationBarTransition.xcodeproj/xcshareddata/xcschemes/YPNavigationBarTransitionTests.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 16 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 40 | 41 | 42 | 43 | 49 | 50 | 52 | 53 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /YPNavigationBarTransition.xcodeproj/xcuserdata/yiplee.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /YPNavigationBarTransition.xcodeproj/xcuserdata/yiplee.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | YPNavigationBarTransitionLibrary.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | YPNavigationBarTransitionTests.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 2 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | E8B064221FEF4FBC007332E8 21 | 22 | primary 23 | 24 | 25 | E8B0642B1FEF4FBC007332E8 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /YPNavigationBarTransition.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /YPNavigationBarTransition.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 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 | 2.0.9 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/UIImage+YPConfigure.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface UIImage (YPConfigure) 28 | 29 | + (UIImage *) yp_transparentImage; 30 | 31 | + (UIImage *) yp_imageWithColor:(UIColor *)color; 32 | + (UIImage *) yp_imageWithColor:(UIColor *)color size:(CGSize) size; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/UIImage+YPConfigure.m: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import "UIImage+YPConfigure.h" 26 | 27 | @implementation UIImage (YPConfigure) 28 | 29 | + (UIImage *) yp_transparentImage { 30 | return [self new]; 31 | } 32 | 33 | + (UIImage *) yp_imageWithColor:(UIColor *)color { 34 | return [self yp_imageWithColor:color size:CGSizeMake(1, 1)]; 35 | } 36 | 37 | + (UIImage *) yp_imageWithColor:(UIColor *)color size:(CGSize) size { 38 | size.width = MAX(0.5, size.width); 39 | size.height = MAX(0.5, size.height); 40 | 41 | CGRect rect = CGRectMake(0.0f, 0.0f, size.width, size.height); 42 | UIGraphicsBeginImageContext(rect.size); 43 | CGContextRef context = UIGraphicsGetCurrentContext(); 44 | 45 | CGContextSetFillColorWithColor(context, [color CGColor]); 46 | CGContextFillRect(context, rect); 47 | 48 | UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); 49 | UIGraphicsEndImageContext(); 50 | 51 | return image; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/UIViewController+YPNavigationBarTransition.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @interface UIViewController (YPNavigationBarTransition) 28 | 29 | - (BOOL) yp_hasCustomNavigationBarStyle; 30 | 31 | - (void) yp_refreshNavigationBarStyle; 32 | 33 | - (CGRect) yp_fakeBarFrameForNavigationBar:(UINavigationBar *)navigationBar; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/UIViewController+YPNavigationBarTransition.m: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import "UIViewController+YPNavigationBarTransition.h" 26 | #import "YPBarConfiguration.h" 27 | #import "UINavigationBar+YPConfigure.h" 28 | 29 | @implementation UIViewController (YPNavigationBarTransition) 30 | 31 | - (BOOL) yp_hasCustomNavigationBarStyle { 32 | return [self conformsToProtocol:@protocol(YPNavigationBarConfigureStyle)]; 33 | } 34 | 35 | - (UINavigationBar *) yp_navigationBar { 36 | if ([self isKindOfClass:[UINavigationController class]]) { 37 | return [(UINavigationController*)self navigationBar]; 38 | } 39 | 40 | return [self.navigationController navigationBar]; 41 | } 42 | 43 | - (void) yp_refreshNavigationBarStyle { 44 | NSParameterAssert([self yp_hasCustomNavigationBarStyle]); 45 | 46 | UINavigationBar *navigationBar = [self yp_navigationBar]; 47 | if (navigationBar.topItem == self.navigationItem) { 48 | id owner = (id)self; 49 | YPBarConfiguration *configuration = [[YPBarConfiguration alloc] initWithBarConfigurationOwner:owner]; 50 | [navigationBar yp_applyBarConfiguration:configuration]; 51 | } 52 | } 53 | 54 | - (CGRect) yp_fakeBarFrameForNavigationBar:(UINavigationBar *)navigationBar { 55 | if (!navigationBar) return CGRectNull; 56 | 57 | UIView *backgroundView = [navigationBar yp_backgroundView]; 58 | CGRect frame = [backgroundView.superview convertRect:backgroundView.frame toView:self.view]; 59 | frame.origin.x = self.view.bounds.origin.x; 60 | return frame; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/YPNavigationBarProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import 27 | 28 | NS_SWIFT_NAME(NavigationBarConfigurations) 29 | typedef NS_OPTIONS(NSUInteger, YPNavigationBarConfigurations) { 30 | YPNavigationBarShow = 0, // show navigationBar 31 | YPNavigationBarHidden = 1, // hide navigationBar 32 | 33 | // bar style 34 | YPNavigationBarStyleLight = 0 << 4, // UIbarStyleDefault 35 | YPNavigationBarStyleBlack = 1 << 4, // UIbarStyleBlack 36 | 37 | YPNavigationBarBackgroundStyleTranslucent = 0 << 8, 38 | YPNavigationBarBackgroundStyleOpaque = 1 << 8, 39 | YPNavigationBarBackgroundStyleTransparent = 2 << 8, 40 | 41 | // bar background 42 | YPNavigationBarBackgroundStyleNone = 0 << 16, 43 | YPNavigationBarBackgroundStyleColor = 1 << 16, 44 | YPNavigationBarBackgroundStyleImage = 2 << 16, 45 | 46 | // shadow image 47 | YPNavigationBarShowShadowImage = 1 << 20, 48 | 49 | YPNavigationBarConfigurationsDefault = 0, 50 | }; 51 | 52 | NS_SWIFT_NAME(NavigationBarConfigureStyle) 53 | @protocol YPNavigationBarConfigureStyle 54 | 55 | - (YPNavigationBarConfigurations) yp_navigtionBarConfiguration; 56 | 57 | - (UIColor *) yp_navigationBarTintColor; 58 | 59 | @optional 60 | 61 | /* 62 | * identifier 用来比较image的name是否是同,如果不传,会使用image的isEqual来比较 63 | */ 64 | - (UIImage *) yp_navigationBackgroundImageWithIdentifier:(NSString **)identifier; 65 | 66 | - (UIColor *) yp_navigationBackgroundColor; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/YPNavigationBarTransition.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | //! Project version number for YPNavigationBarTransition. 28 | FOUNDATION_EXPORT double YPNavigationBarTransitionVersionNumber; 29 | 30 | //! Project version string for YPNavigationBarTransition. 31 | FOUNDATION_EXPORT const unsigned char YPNavigationBarTransitionVersionString[]; 32 | // 33 | #import 34 | #import 35 | #import 36 | #import 37 | #import 38 | 39 | 40 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/YPNavigationBarTransitionCenter.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | NS_ASSUME_NONNULL_BEGIN 28 | 29 | NS_SWIFT_NAME(NavigationBarTransitionCenter) 30 | @interface YPNavigationBarTransitionCenter : NSObject 31 | 32 | @property (nonatomic, assign) BOOL isTransitionNavigationBar; 33 | 34 | - (instancetype) init NS_UNAVAILABLE; 35 | + (instancetype) new NS_UNAVAILABLE; 36 | - (instancetype) initWithDefaultBarConfiguration:(id)_default NS_DESIGNATED_INITIALIZER; 37 | 38 | - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated; 39 | - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated; 40 | 41 | @end 42 | 43 | NS_ASSUME_NONNULL_END 44 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/YPNavigationController.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPNavigationController.h 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 2018/4/20. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YPNavigationController : UINavigationController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/YPNavigationController.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPNavigationController.m 3 | // YPNavigationBarTransition-Example 4 | // 5 | // Created by Guoyin Lee on 2018/4/20. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPNavigationController.h" 10 | #import "YPNavigationControllerDelegateProxy.h" 11 | #import "YPNavigationBarTransitionCenter.h" 12 | #import "YPNavigationBarProtocol.h" 13 | 14 | @interface YPNavigationController () 15 | < 16 | UIGestureRecognizerDelegate, 17 | UINavigationControllerDelegate 18 | > 19 | 20 | @property (nonatomic, strong) YPNavigationBarTransitionCenter *center; 21 | @property (nonatomic, weak, nullable) id navigationDelegate; 22 | @property (nonatomic, strong, nullable) YPNavigationControllerDelegateProxy *delegateProxy; 23 | 24 | @end 25 | 26 | @implementation YPNavigationController 27 | 28 | - (void)viewDidLoad { 29 | [super viewDidLoad]; 30 | 31 | // see YPNavigationController+Configure.{h,m} in Example Project 32 | NSAssert([self conformsToProtocol:@protocol(YPNavigationBarConfigureStyle)], 33 | @"you must implement YPNavigationBarConfigureStyle for YPNavigationController in subclass or category"); 34 | 35 | _center = [[YPNavigationBarTransitionCenter alloc] initWithDefaultBarConfiguration:(id)self]; 36 | if (!self.delegate) { 37 | self.delegate = self; 38 | } 39 | self.interactivePopGestureRecognizer.delegate = self; 40 | } 41 | 42 | - (void) setDelegate:(id)delegate { 43 | if (delegate == self || delegate == nil) { 44 | _navigationDelegate = nil; 45 | _delegateProxy = nil; 46 | super.delegate = self; 47 | } else { 48 | _navigationDelegate = delegate; 49 | _delegateProxy = [[YPNavigationControllerDelegateProxy alloc] initWithNavigationTarget:_navigationDelegate 50 | interceptor:self]; 51 | super.delegate = (id)_delegateProxy; 52 | } 53 | } 54 | 55 | #pragma mark - UINavigationControllerDelegate 56 | 57 | - (void) navigationController:(UINavigationController *)navigationController 58 | willShowViewController:(UIViewController *)viewController 59 | animated:(BOOL)animated { 60 | id navigationDelegate = self.navigationDelegate; 61 | if ([navigationDelegate respondsToSelector:@selector(navigationController:willShowViewController:animated:)]) { 62 | [navigationDelegate navigationController:navigationController 63 | willShowViewController:viewController 64 | animated:animated]; 65 | } 66 | 67 | [_center navigationController:navigationController 68 | willShowViewController:viewController 69 | animated:animated]; 70 | } 71 | 72 | - (void) navigationController:(UINavigationController *)navigationController 73 | didShowViewController:(UIViewController *)viewController 74 | animated:(BOOL)animated { 75 | id navigationDelegate = self.navigationDelegate; 76 | if ([navigationDelegate respondsToSelector:@selector(navigationController:didShowViewController:animated:)]) { 77 | [navigationDelegate navigationController:navigationController 78 | didShowViewController:viewController 79 | animated:animated]; 80 | } 81 | 82 | [_center navigationController:navigationController 83 | didShowViewController:viewController 84 | animated:animated]; 85 | } 86 | 87 | #pragma mark - UIGestureRecognizerDelegate 88 | 89 | - (BOOL) gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer { 90 | if (gestureRecognizer == self.interactivePopGestureRecognizer) { 91 | if ([gestureRecognizer isKindOfClass:UIScreenEdgePanGestureRecognizer.class] && _center.isTransitionNavigationBar) { 92 | return NO; 93 | } 94 | return self.viewControllers.count > 1; 95 | } 96 | 97 | return YES; 98 | } 99 | 100 | @end 101 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/UINavigationBar+YPConfigure.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @class YPBarConfiguration; 28 | 29 | @interface UINavigationBar (YPConfigure) 30 | 31 | @property (nonatomic, strong, readonly) YPBarConfiguration* currentBarConfigure; 32 | 33 | - (void) yp_adjustWithBarStyle:(UIBarStyle)barStyle tintColor:(UIColor *)tintColor; 34 | - (void) yp_applyBarConfiguration:(YPBarConfiguration *)configure; 35 | 36 | - (UIView *) yp_backgroundView; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/UINavigationBar+YPConfigure.m: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | #import "UINavigationBar+YPConfigure.h" 25 | #import "YPBarConfiguration.h" 26 | #import "UIImage+YPConfigure.h" 27 | #import 28 | 29 | @implementation UINavigationBar (YPConfigure) 30 | 31 | - (void) yp_adjustWithBarStyle:(UIBarStyle)barStyle tintColor:(UIColor *)tintColor { 32 | self.barStyle = barStyle; 33 | self.tintColor = tintColor; 34 | } 35 | 36 | - (UIView *) yp_backgroundView { 37 | return [self valueForKey:@"_backgroundView"]; 38 | } 39 | 40 | - (void) yp_applyBarConfiguration:(YPBarConfiguration *)configure { 41 | #if DEBUG 42 | if (@available(iOS 11,*)) { 43 | NSAssert(!self.prefersLargeTitles, @"large titles is not supported"); 44 | } 45 | #endif 46 | 47 | [self yp_adjustWithBarStyle:configure.barStyle tintColor:configure.tintColor]; 48 | 49 | UIView *barBackgroundView = [self yp_backgroundView]; 50 | UIImage* const transpanrentImage = [UIImage yp_transparentImage]; 51 | if (configure.transparent) { 52 | barBackgroundView.alpha = 0; 53 | if (@available(iOS 13.0, *)) { 54 | UINavigationBarAppearance *appearance = [[self standardAppearance] copy]; 55 | [appearance configureWithTransparentBackground]; 56 | self.scrollEdgeAppearance = appearance; 57 | self.standardAppearance = appearance; 58 | } else { 59 | self.translucent = YES; 60 | [self setBackgroundImage:transpanrentImage forBarMetrics:UIBarMetricsDefault]; 61 | } 62 | } else { 63 | barBackgroundView.alpha = 1; 64 | if (@available(iOS 13.0, *)) { 65 | UINavigationBarAppearance *appearance = [[self standardAppearance] copy]; 66 | if (configure.translucent) { 67 | [appearance configureWithDefaultBackground]; 68 | UIBlurEffectStyle effectStyle = configure.barStyle == UIBarStyleDefault ? UIBlurEffectStyleLight : UIBlurEffectStyleDark; 69 | appearance.backgroundEffect = [UIBlurEffect effectWithStyle:effectStyle]; 70 | } else { 71 | [appearance configureWithOpaqueBackground]; 72 | } 73 | if (configure.backgroundImage) { 74 | appearance.backgroundImage = configure.backgroundImage; 75 | } else if (configure.backgroundColor) { 76 | appearance.backgroundColor = configure.backgroundColor; 77 | } 78 | if (!configure.shadowImage) { 79 | appearance.shadowImage = nil; 80 | appearance.shadowColor = nil; 81 | } 82 | self.scrollEdgeAppearance = appearance; 83 | self.standardAppearance = appearance; 84 | } else { 85 | self.translucent = configure.translucent; 86 | UIImage* backgroundImage = configure.backgroundImage; 87 | if (!backgroundImage && configure.backgroundColor) { 88 | backgroundImage = [UIImage yp_imageWithColor:configure.backgroundColor]; 89 | } 90 | [self setBackgroundImage:backgroundImage forBarMetrics:UIBarMetricsDefault]; 91 | } 92 | } 93 | 94 | self.shadowImage = configure.shadowImage ? nil : transpanrentImage; 95 | 96 | [self setCurrentBarConfigure:configure]; 97 | } 98 | 99 | - (YPBarConfiguration *) currentBarConfigure { 100 | return objc_getAssociatedObject(self, @selector(currentBarConfigure)); 101 | } 102 | 103 | - (void) setCurrentBarConfigure:(YPBarConfiguration *)currentBarConfigure { 104 | objc_setAssociatedObject(self, @selector(currentBarConfigure), currentBarConfigure, OBJC_ASSOCIATION_RETAIN_NONATOMIC); 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/UIToolbar+YPConfigure.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | @class YPBarConfiguration; 28 | 29 | @interface UIToolbar (YPConfigure) 30 | 31 | - (void) yp_applyBarConfiguration:(YPBarConfiguration *)configure; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/UIToolbar+YPConfigure.m: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import "UIToolbar+YPConfigure.h" 26 | #import "YPBarConfiguration.h" 27 | #import "UIImage+YPConfigure.h" 28 | 29 | @implementation UIToolbar (YPConfigure) 30 | 31 | - (void) yp_applyBarConfiguration:(YPBarConfiguration *)configure { 32 | self.barStyle = configure.barStyle; 33 | 34 | UIImage* const transpanrentImage = [UIImage yp_transparentImage]; 35 | if (configure.transparent) { 36 | if (@available(iOS 13.0, *)) { 37 | UIToolbarAppearance *appearance = [[self standardAppearance] copy]; 38 | [appearance configureWithTransparentBackground]; 39 | if (@available(iOS 15.0, *)) { 40 | self.scrollEdgeAppearance = appearance; 41 | } 42 | self.standardAppearance = appearance; 43 | } else { 44 | self.translucent = YES; 45 | [self setBackgroundImage:transpanrentImage forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; 46 | } 47 | } else { 48 | if (@available(iOS 13.0, *)) { 49 | UIToolbarAppearance *appearance = [[self standardAppearance] copy]; 50 | if (configure.translucent) { 51 | [appearance configureWithDefaultBackground]; 52 | UIBlurEffectStyle effectStyle = configure.barStyle == UIBarStyleDefault ? UIBlurEffectStyleLight : UIBlurEffectStyleDark; 53 | appearance.backgroundEffect = [UIBlurEffect effectWithStyle:effectStyle]; 54 | } else { 55 | [appearance configureWithOpaqueBackground]; 56 | } 57 | if (configure.backgroundImage) { 58 | appearance.backgroundImage = configure.backgroundImage; 59 | } else if (configure.backgroundColor) { 60 | appearance.backgroundColor = configure.backgroundColor; 61 | } 62 | if (!configure.shadowImage) { 63 | appearance.shadowImage = nil; 64 | appearance.shadowColor = nil; 65 | } 66 | if (@available(iOS 15.0, *)) { 67 | self.scrollEdgeAppearance = appearance; 68 | } 69 | self.standardAppearance = appearance; 70 | } else { 71 | self.translucent = configure.translucent; 72 | UIImage* backgroundImage = configure.backgroundImage; 73 | if (!backgroundImage && configure.backgroundColor) { 74 | backgroundImage = [UIImage yp_imageWithColor:configure.backgroundColor]; 75 | } 76 | [self setBackgroundImage:backgroundImage forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault]; 77 | } 78 | } 79 | 80 | UIImage* shadowImage = configure.shadowImage ? nil : transpanrentImage; 81 | [self setShadowImage:shadowImage forToolbarPosition:UIBarPositionAny]; 82 | } 83 | 84 | @end 85 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/YPBarConfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | 27 | NS_ASSUME_NONNULL_BEGIN 28 | 29 | @interface YPBarConfiguration : NSObject 30 | 31 | @property (nonatomic, assign, readonly) BOOL hidden; 32 | @property (nonatomic, assign, readonly) UIBarStyle barStyle; 33 | @property (nonatomic, assign, readonly) BOOL translucent; 34 | @property (nonatomic, assign, readonly) BOOL transparent; 35 | @property (nonatomic, assign, readonly) BOOL shadowImage; 36 | @property (nonatomic, strong, readonly) UIColor *tintColor; 37 | @property (nonatomic, strong, readonly, nullable) UIColor *backgroundColor; 38 | @property (nonatomic, strong, readonly, nullable) UIImage *backgroundImage; 39 | @property (nonatomic, strong, readonly, nullable) NSString *backgroundImageIdentifier; 40 | 41 | - (instancetype) init NS_UNAVAILABLE; 42 | - (instancetype) initWithBarConfigurations:(YPNavigationBarConfigurations)configurations 43 | tintColor:(nullable UIColor*) tintColor 44 | backgroundColor:(nullable UIColor *)backgroundColor 45 | backgroundImage:(nullable UIImage *)backgroundImage 46 | backgroundImageIdentifier:(nullable NSString*)backgroundImageIdentifier NS_DESIGNATED_INITIALIZER; 47 | @end 48 | 49 | @interface YPBarConfiguration (YPBarTransition) 50 | 51 | - (instancetype) initWithBarConfigurationOwner:(id)owner; 52 | 53 | - (BOOL) isVisible; 54 | 55 | - (BOOL) useSystemBarBackground; 56 | 57 | @end 58 | 59 | NS_ASSUME_NONNULL_END 60 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/YPBarConfiguration.m: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import "YPBarConfiguration.h" 26 | 27 | @implementation YPBarConfiguration 28 | 29 | - (instancetype) init { 30 | return [self initWithBarConfigurations:YPNavigationBarConfigurationsDefault 31 | tintColor:nil 32 | backgroundColor:nil 33 | backgroundImage:nil 34 | backgroundImageIdentifier:nil]; 35 | } 36 | 37 | - (instancetype) initWithBarConfigurations:(YPNavigationBarConfigurations)configurations 38 | tintColor:(UIColor *)tintColor 39 | backgroundColor:(UIColor *)backgroundColor 40 | backgroundImage:(UIImage *)backgroundImage 41 | backgroundImageIdentifier:(NSString *)backgroundImageIdentifier { 42 | self = [super init]; 43 | if (!self) return nil; 44 | 45 | do { 46 | _hidden = (configurations & YPNavigationBarHidden) > 0; 47 | 48 | _barStyle = (configurations & YPNavigationBarStyleBlack) > 0 ? UIBarStyleBlack : UIBarStyleDefault; 49 | if (!tintColor) { 50 | tintColor = _barStyle == UIBarStyleBlack ? [UIColor whiteColor] : [UIColor blackColor]; 51 | } 52 | _tintColor = tintColor; 53 | 54 | if (_hidden) break; 55 | 56 | _transparent = (configurations & YPNavigationBarBackgroundStyleTransparent) > 0; 57 | if (_transparent) break; 58 | 59 | // show shadow image only if not transparent 60 | _shadowImage = (configurations & YPNavigationBarShowShadowImage) > 0; 61 | _translucent = (configurations & YPNavigationBarBackgroundStyleOpaque) == 0; 62 | 63 | if ((configurations & YPNavigationBarBackgroundStyleImage) > 0 && backgroundImage) { 64 | _backgroundImage = backgroundImage; 65 | _backgroundImageIdentifier = [backgroundImageIdentifier copy]; 66 | } else if (configurations & YPNavigationBarBackgroundStyleColor){ 67 | _backgroundColor = backgroundColor; 68 | } 69 | } while (0); 70 | 71 | return self; 72 | } 73 | 74 | @end 75 | 76 | @implementation YPBarConfiguration (YPBarTransition) 77 | 78 | - (instancetype) initWithBarConfigurationOwner:(id)owner { 79 | YPNavigationBarConfigurations configurations = [owner yp_navigtionBarConfiguration]; 80 | UIColor *tintColor = [owner yp_navigationBarTintColor]; 81 | 82 | UIImage *backgroundImage = nil; 83 | NSString *imageIdentifier = nil; 84 | UIColor *backgroundColor = nil; 85 | 86 | if (!(configurations & YPNavigationBarBackgroundStyleTransparent)) { 87 | if (configurations & YPNavigationBarBackgroundStyleImage) { 88 | backgroundImage = [owner yp_navigationBackgroundImageWithIdentifier:&imageIdentifier]; 89 | } else if (configurations & YPNavigationBarBackgroundStyleColor) { 90 | backgroundColor = [owner yp_navigationBackgroundColor]; 91 | } 92 | } 93 | 94 | return [self initWithBarConfigurations:configurations 95 | tintColor:tintColor 96 | backgroundColor:backgroundColor 97 | backgroundImage:backgroundImage 98 | backgroundImageIdentifier:imageIdentifier]; 99 | } 100 | 101 | - (BOOL) isVisible { 102 | return !self.hidden && !self.transparent; 103 | } 104 | 105 | - (BOOL) useSystemBarBackground { 106 | return !self.backgroundColor && !self.backgroundImage; 107 | } 108 | 109 | @end 110 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/YPNavigationBarTransitionCenterInternal.h: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) 2017 yiplee 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | */ 24 | 25 | #import 26 | #import 27 | 28 | BOOL YPTransitionNeedShowFakeBar(YPBarConfiguration *from,YPBarConfiguration *to); 29 | 30 | @interface YPNavigationBarTransitionCenter () 31 | 32 | @property (nonatomic, strong) UIToolbar *fromViewControllerFakeBar; 33 | @property (nonatomic, strong) UIToolbar *toViewControllerFakeBar; 34 | 35 | @property (nonatomic, strong, readonly) YPBarConfiguration *defaultBarConfigure; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/YPNavigationControllerDelegateProxy.h: -------------------------------------------------------------------------------- 1 | // 2 | // YPNavigationControllerDelegateProxy.h 3 | // YPNavigationBarTransition 4 | // 5 | // Created by Guoyin Lee on 2018/4/25. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | NS_ASSUME_NONNULL_BEGIN 12 | 13 | @class YPNavigationController; 14 | @protocol UINavigationControllerDelegate; 15 | 16 | @interface YPNavigationControllerDelegateProxy : NSProxy 17 | 18 | - (instancetype) initWithNavigationTarget:(nullable id)navigationTarget 19 | interceptor:(YPNavigationController *)interceptor; 20 | - (instancetype) init NS_UNAVAILABLE; 21 | + (instancetype) new NS_UNAVAILABLE; 22 | 23 | NS_ASSUME_NONNULL_END 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /YPNavigationBarTransition/internal/YPNavigationControllerDelegateProxy.m: -------------------------------------------------------------------------------- 1 | // 2 | // YPNavigationControllerDelegateProxy.m 3 | // YPNavigationBarTransition 4 | // 5 | // Created by Guoyin Lee on 2018/4/25. 6 | // Copyright © 2018 yiplee. All rights reserved. 7 | // 8 | 9 | #import "YPNavigationControllerDelegateProxy.h" 10 | #import 11 | 12 | static BOOL isInterceptedSelector(SEL sel) { 13 | return ( 14 | sel == @selector(navigationController:willShowViewController:animated:) || 15 | sel == @selector(navigationController:didShowViewController:animated:) 16 | ); 17 | } 18 | 19 | @implementation YPNavigationControllerDelegateProxy { 20 | __weak id _navigationTarget; 21 | __weak YPNavigationController *_interceptor; 22 | } 23 | 24 | - (instancetype) initWithNavigationTarget:(nullable id)navigationTarget 25 | interceptor:(YPNavigationController *)interceptor { 26 | NSParameterAssert(interceptor != nil); 27 | if (self) { 28 | _navigationTarget = navigationTarget; 29 | _interceptor = interceptor; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | - (BOOL)respondsToSelector:(SEL)aSelector { 36 | return isInterceptedSelector(aSelector) 37 | || [_navigationTarget respondsToSelector:aSelector]; 38 | } 39 | 40 | - (id)forwardingTargetForSelector:(SEL)aSelector { 41 | return isInterceptedSelector(aSelector) ? _interceptor : _navigationTarget; 42 | } 43 | 44 | - (void)forwardInvocation:(NSInvocation *)invocation { 45 | void *nullPointer = NULL; 46 | [invocation setReturnValue:&nullPointer]; 47 | } 48 | 49 | - (NSMethodSignature *)methodSignatureForSelector:(SEL)selector { 50 | return [NSObject instanceMethodSignatureForSelector:@selector(init)]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /YPNavigationBarTransitionTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /YPNavigationBarTransitionTests/barStyleDiffSpec.m: -------------------------------------------------------------------------------- 1 | // 2 | // barStyleDiffSpec.m 3 | // YPNavigationBarTransition 4 | // 5 | // Created by Guoyin Lee on 27/12/2017. 6 | // Copyright 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YPNavigationBarTransitionCenterInternal.h" 11 | #import "TranslucentBlackBarStyleObject.h" 12 | #import "ColorNavigationBarStyleObject.h" 13 | 14 | SPEC_BEGIN(barStyleDiffSpec) 15 | 16 | describe(@"barStyleDiff", ^{ 17 | let(translucentBlackStyle, ^id{ 18 | TranslucentBlackBarStyleObject *object = [TranslucentBlackBarStyleObject new]; 19 | return [[YPBarConfiguration alloc] initWithBarConfigurationOwner:object]; 20 | }); 21 | 22 | let(WhitColorBarStyle, ^id{ 23 | ColorNavigationBarStyleObject *object = [ColorNavigationBarStyleObject new]; 24 | object.backgroundColor = [UIColor whiteColor]; 25 | return [[YPBarConfiguration alloc] initWithBarConfigurationOwner:object]; 26 | }); 27 | 28 | context(@"translucent black bar", ^{ 29 | it(@"configure style should be", ^{ 30 | YPBarConfiguration *conf = translucentBlackStyle; 31 | [[conf shouldNot] beNil]; 32 | [[theValue(conf.hidden) should] beNo]; 33 | [[theValue(conf.transparent) should] beNo]; 34 | [[theValue(conf.translucent) should] beYes]; 35 | [[theValue(conf.barStyle) should] equal:@(UIBarStyleBlack)]; 36 | [[conf.tintColor should] equal:[UIColor whiteColor]]; 37 | [[conf.backgroundColor should] beNil]; 38 | [[conf.backgroundImage should] beNil]; 39 | }); 40 | 41 | it(@"should be visible & use system blur background", ^{ 42 | YPBarConfiguration *conf = translucentBlackStyle; 43 | [[conf shouldNot] beNil]; 44 | [[theValue(conf.isVisible) should] beYes]; 45 | [[theValue(conf.useSystemBarBackground) should] beYes]; 46 | }); 47 | }); 48 | 49 | context(@"color bar", ^{ 50 | it(@"configure style should be", ^{ 51 | YPBarConfiguration *conf = WhitColorBarStyle; 52 | [[conf shouldNot] beNil]; 53 | [[theValue(conf.hidden) should] beNo]; 54 | [[theValue(conf.transparent) should] beNo]; 55 | [[theValue(conf.translucent) should] beYes]; 56 | [[theValue(conf.barStyle) should] equal:@(UIBarStyleDefault)]; 57 | [[conf.tintColor should] equal:[UIColor blackColor]]; 58 | [[conf.backgroundColor should] beNonNil]; 59 | [[conf.backgroundImage should] beNil]; 60 | }); 61 | 62 | it(@"should be visible & not use system blur background", ^{ 63 | YPBarConfiguration *conf = WhitColorBarStyle; 64 | [[conf shouldNot] beNil]; 65 | [[theValue(conf.isVisible) should] beYes]; 66 | [[theValue(conf.useSystemBarBackground) shouldNot] beYes]; 67 | }); 68 | }); 69 | 70 | context(@"diff bar style", ^{ 71 | it(@"should use fake bar", ^{ 72 | BOOL useFakeBar = YPTransitionNeedShowFakeBar(WhitColorBarStyle, translucentBlackStyle); 73 | [[theValue(useFakeBar) should] beYes]; 74 | }); 75 | }); 76 | }); 77 | 78 | SPEC_END 79 | -------------------------------------------------------------------------------- /YPNavigationBarTransitionTests/objects/ColorNavigationBarStyleObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // ColorNavigationBarStyleObject.h 3 | // YPNavigationBarTransitionTests 4 | // 5 | // Created by Li Guoyin on 2017/12/30. 6 | // Copyright © 2017年 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ColorNavigationBarStyleObject : NSObject 13 | 14 | @property (nonatomic, strong) UIColor *backgroundColor; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /YPNavigationBarTransitionTests/objects/ColorNavigationBarStyleObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // ColorNavigationBarStyleObject.m 3 | // YPNavigationBarTransitionTests 4 | // 5 | // Created by Li Guoyin on 2017/12/30. 6 | // Copyright © 2017年 yiplee. All rights reserved. 7 | // 8 | 9 | #import "ColorNavigationBarStyleObject.h" 10 | 11 | @implementation ColorNavigationBarStyleObject 12 | 13 | - (YPNavigationBarConfigurations) yp_navigtionBarConfiguration { 14 | return YPNavigationBarConfigurationsDefault | YPNavigationBarBackgroundStyleColor; 15 | } 16 | 17 | - (UIColor *) yp_navigationBarTintColor { 18 | return nil; 19 | } 20 | 21 | - (UIColor *) yp_navigationBackgroundColor { 22 | return self.backgroundColor; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /YPNavigationBarTransitionTests/objects/TranslucentBlackBarStyleObject.h: -------------------------------------------------------------------------------- 1 | // 2 | // TranslucentBlackBarStyleObject.h 3 | // YPNavigationBarTransitionTests 4 | // 5 | // Created by Guoyin Lee on 27/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface TranslucentBlackBarStyleObject : NSObject 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /YPNavigationBarTransitionTests/objects/TranslucentBlackBarStyleObject.m: -------------------------------------------------------------------------------- 1 | // 2 | // TranslucentBlackBarStyleObject.m 3 | // YPNavigationBarTransitionTests 4 | // 5 | // Created by Guoyin Lee on 27/12/2017. 6 | // Copyright © 2017 yiplee. All rights reserved. 7 | // 8 | 9 | #import "TranslucentBlackBarStyleObject.h" 10 | 11 | @implementation TranslucentBlackBarStyleObject 12 | 13 | - (YPNavigationBarConfigurations) yp_navigtionBarConfiguration { 14 | return YPNavigationBarConfigurationsDefault | YPNavigationBarStyleBlack; 15 | } 16 | 17 | - (UIColor *) yp_navigationBarTintColor { 18 | return [UIColor whiteColor]; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /docs/how_to_use_CN.markdown: -------------------------------------------------------------------------------- 1 | # 怎么使用 YPNavigationBarTransition 2 | 3 | YPNavigationBarTransition 依靠 UINavigationControllerDelegate 的 willShow & didShow 驱动来实现自动管理 navigationBar 的切换。 4 | 对于每一个对 navigationBar 的样式有自定义需求的 viewController,可以通过实现 `YPNavigationBarConfigureStyle` 协议来实现。 5 | 每次 navigationController push 或者 pop viewController 的时候,YPNavigationBarTransition 通过对比当前 navigationBar 6 | 的样式和目标 viewController 指定的样式来判断是否需要添加 fake bar (用 UIToolbar)来模拟 navigation bar 的切换。 7 | 8 | ## `YPNavigationBarConfigureStyle` 协议 9 | 10 | ```objective-c 11 | typedef NS_ENUM(NSUInteger, YPNavigationBarConfigurations) { 12 | /* 13 | * 是否隐藏 navigation bar,默认是 show。 14 | */ 15 | YPNavigationBarShow = 0, 16 | YPNavigationBarHidden = 1, 17 | /* 18 | * YPNavigationBarStyleLight = UIbarStyleDefault 19 | * YPNavigationBarStyleBlack = UIbarStyleBlack 20 | * 21 | * bar style 会影响 status bar 的样式,为 black 的时候 status bar 是白色,light 的时候是黑色。 22 | * 当没有自定义 background color 和 background image 的时候,navigation bar 的颜色也由 bar style 决定 23 | * 另外如果没有提供有效的 tintColor,YPNavigationBarTransition 将根据 bar style 自动设置 tintColor 24 | */ 25 | YPNavigationBarStyleLight = 0 << 4, // UIbarStyleDefault 26 | YPNavigationBarStyleBlack = 1 << 4, // UIbarStyleBlack 27 | /* 28 | * translucent = 半透明,transparent = 全透明,opaque = 不透明 29 | */ 30 | YPNavigationBarBackgroundStyleTranslucent = 0 << 8, 31 | YPNavigationBarBackgroundStyleOpaque = 1 << 8, 32 | YPNavigationBarBackgroundStyleTransparent = 2 << 8, 33 | /* 34 | * 使用颜色或者图片来配置 navigation bar 的 background image 35 | */ 36 | YPNavigationBarBackgroundStyleNone = 0 << 16, 37 | YPNavigationBarBackgroundStyleColor = 1 << 16, 38 | YPNavigationBarBackgroundStyleImage = 2 << 16, 39 | YPNavigationBarConfigurationsDefault = 0, 40 | /* 41 | * 是否显示 UINavigationBar 下方的横线,默认不显示 42 | * 在全透明 (Transparent) 的时候,将忽略 shadow image 的设置 43 | */ 44 | YPNavigationBarShowShadowImage = 1 << 20, 45 | }; 46 | 47 | - (YPNavigationBarConfigurations) yp_navigtionBarConfiguration; 48 | ``` 49 | 50 | **[required]** 返回 navigation bar 配置 51 | 52 | ```objective-c 53 | - (UIColor *) yp_navigationBarTintColor; 54 | ``` 55 | 56 | **[required]** navigation bar tint color,影响 bar item 的颜色; 57 | 如果返回 nil,bar style 是 YPNavigationBarStyleBlack 的话,将使用白色作为 tintColor, 58 | bar style 是 YPNavigationBarStyleLight 的话,将使用黑色作为 tintColor。 59 | 60 | ```objective-c 61 | - (UIImage *) yp_navigationBackgroundImageWithIdentifier:(NSString **)identifier; 62 | ``` 63 | 64 | **[optional]** navigation bar background image,`identifier`作为 image 的 id 使用,同 id 的图片看作是同一张图片,在判断是否需要使用 fake bar 的时候需要用到。如果 bar configuration使用了 YPNavigationBarBackgroundStyleImage,这个方法一定要实现。 65 | 66 | ```objective-c 67 | - (UIColor *) yp_navigationBackgroundColor; 68 | ``` 69 | 70 | **[optional]** navigation bar background color。如果 bar configuration 71 | 使用了 YPNavigationBarBackgroundStyleColor,这个方法一定要实现。 72 | 73 | ## 动态改变 NavigationBar 的样式 74 | 75 | 在合适的时机调用 UIViewController 的方法 yp_refreshNavigationBarStyle,即可将 UIViewController 实现的 `YPNavigationBarConfigureStyle` 当前 76 | 样式同步到 navigation bar 上。参考 Example 里面的 [YPGradientDemoViewController](https://github.com/yiplee/YPNavigationBarTransition/blob/master/Examples/share/YPGradientDemoViewController.m#L148) 77 | 78 | ## 最佳实践 79 | 80 | **默认 YPNavigationBarConfigureStyle 实现** 自 **2.0.2** 版本开始,封装了 center 的 YPNavigationController 已内置在 framework 内,只需要给 YPNavigationController 加一个 Category 实现 YPNavigationBarConfigureStyle 协议即可。 81 | 82 | **NavigationItem Title** 建议使用一个 UILabel 作为 navigationItem 的 titleView 来展现页面 title,这样可以让页面完全自己控制 title 的颜色、 83 | 字体等等,并且还可以实现 subtitle。可以参考 Example 里面的 [YPNavigationTitleLabel](https://github.com/yiplee/YPNavigationBarTransition/blob/master/Examples/share/YPNavigationTitleLabel.m)。 84 | 85 | **ScrollView 跳动问题** 在转场过程中,navigationBar 的 translucent 属性可能发生了改变, 86 | 然后导致了 scrollView 的 frame 和 contentInset 发生改变,页面展示内容位置变化。如果遇到这种情况,建议设置对应 controller 的 extendedLayoutIncludesOpaqueBars (IB 里面的 under opaque bar) 为 YES,即可避开这个问题。 87 | 88 | ## ⚠️ 注意 89 | 90 | - 不支持 iOS 11 新增的 navigationBar large title。 91 | - 使用默认配置的页面,不用实现 YPNavigationBarConfigureStyle 协议。 92 | -------------------------------------------------------------------------------- /run_unit_test.sh: -------------------------------------------------------------------------------- 1 | bundler install 2 | bundle exec pod install 3 | xcodebuild analyze test -workspace YPNavigationBarTransition.xcworkspace -scheme YPNavigationBarTransitionLibrary -sdk iphonesimulator -destination "OS=11.3,name=iPhone 8" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c 4 | -------------------------------------------------------------------------------- /screenshots/gif-01.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/screenshots/gif-01.gif -------------------------------------------------------------------------------- /screenshots/gif-02.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/screenshots/gif-02.gif -------------------------------------------------------------------------------- /screenshots/gif-03.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yiplee/YPNavigationBarTransition/7543ff1ef819003bef06d8a0f7c1e93e2b2b3fbe/screenshots/gif-03.gif --------------------------------------------------------------------------------