From 543ea090f6857bcc9f2e5358aba9b9b7a484ff6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gruber=20Krist=E2=88=9A=E2=89=A5f?= Date: Mon, 12 Oct 2015 23:12:34 +0200 Subject: [PATCH] Moved logic from pop/pushViewController:animated to -navigationController:willShowViewController:animated:. This way when user presses back button quickly enough the transition will happen anyway. --- .../project.pbxproj | 7 +++++- ...KFadeNavigationController-Example.xcscheme | 13 ++++++----- .../GKFadeNavigationController-Info.plist | 2 +- ...roller-GKFadeNavigationController.xcscheme | 22 ++++++++++++++----- ...xample-GKFadeNavigationController.xcscheme | 22 ++++++++++++++----- ...roller-GKFadeNavigationController.xcscheme | 22 ++++++++++++++----- ..._Tests-GKFadeNavigationController.xcscheme | 22 ++++++++++++++----- Example/Tests/Tests-Info.plist | 2 +- GKFadeNavigationController.podspec | 2 +- Pod/Classes/GKFadeNavigationController.m | 21 ++++-------------- 10 files changed, 89 insertions(+), 46 deletions(-) diff --git a/Example/GKFadeNavigationController.xcodeproj/project.pbxproj b/Example/GKFadeNavigationController.xcodeproj/project.pbxproj index 84f0aaf..b9415ca 100644 --- a/Example/GKFadeNavigationController.xcodeproj/project.pbxproj +++ b/Example/GKFadeNavigationController.xcodeproj/project.pbxproj @@ -247,7 +247,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = GK; - LastUpgradeCheck = 0510; + LastUpgradeCheck = 0700; ORGANIZATIONNAME = "Gruber KristoĢf"; TargetAttributes = { 6003F5AD195388D20070C39A = { @@ -456,6 +456,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -521,6 +522,7 @@ INFOPLIST_FILE = "GKFadeNavigationController/GKFadeNavigationController-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; MODULE_NAME = ExampleApp; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -537,6 +539,7 @@ INFOPLIST_FILE = "GKFadeNavigationController/GKFadeNavigationController-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; MODULE_NAME = ExampleApp; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; }; @@ -559,6 +562,7 @@ "$(inherited)", ); INFOPLIST_FILE = "Tests/Tests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GKFadeNavigationController_Example.app/GKFadeNavigationController_Example"; WRAPPER_EXTENSION = xctest; @@ -578,6 +582,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Tests/Tests-Prefix.pch"; INFOPLIST_FILE = "Tests/Tests-Info.plist"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GKFadeNavigationController_Example.app/GKFadeNavigationController_Example"; WRAPPER_EXTENSION = xctest; diff --git a/Example/GKFadeNavigationController.xcodeproj/xcshareddata/xcschemes/GKFadeNavigationController-Example.xcscheme b/Example/GKFadeNavigationController.xcodeproj/xcshareddata/xcschemes/GKFadeNavigationController-Example.xcscheme index a21dcae..dcd73c8 100644 --- a/Example/GKFadeNavigationController.xcodeproj/xcshareddata/xcschemes/GKFadeNavigationController-Example.xcscheme +++ b/Example/GKFadeNavigationController.xcodeproj/xcshareddata/xcschemes/GKFadeNavigationController-Example.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -48,15 +48,18 @@ ReferencedContainer = "container:GKFadeNavigationController.xcodeproj"> + + @@ -72,10 +75,10 @@ diff --git a/Example/GKFadeNavigationController/GKFadeNavigationController-Info.plist b/Example/GKFadeNavigationController/GKFadeNavigationController-Info.plist index c263567..93240ad 100644 --- a/Example/GKFadeNavigationController/GKFadeNavigationController-Info.plist +++ b/Example/GKFadeNavigationController/GKFadeNavigationController-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-GKFadeNavigationController_Example-GKFadeNavigationController-GKFadeNavigationController.xcscheme b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-GKFadeNavigationController_Example-GKFadeNavigationController-GKFadeNavigationController.xcscheme index 32da211..4eb6369 100644 --- a/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-GKFadeNavigationController_Example-GKFadeNavigationController-GKFadeNavigationController.xcscheme +++ b/Example/Pods/Pods.xcodeproj/xcshareddata/xcschemes/Pods-GKFadeNavigationController_Example-GKFadeNavigationController-GKFadeNavigationController.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + + + CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - org.cocoapods.demo.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/GKFadeNavigationController.podspec b/GKFadeNavigationController.podspec index ac9a4e8..0a20df8 100644 --- a/GKFadeNavigationController.podspec +++ b/GKFadeNavigationController.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "GKFadeNavigationController" - s.version = "0.5.1" + s.version = "0.5.2" s.summary = "A Navigation Controller which supports animated hiding of the Navigation Bar" s.description = <<-DESC This is an example implementation of a `UINavigationController` with support of animated hiding and showing it's Navigation Bar. diff --git a/Pod/Classes/GKFadeNavigationController.m b/Pod/Classes/GKFadeNavigationController.m index 2083c2e..dd20efb 100644 --- a/Pod/Classes/GKFadeNavigationController.m +++ b/Pod/Classes/GKFadeNavigationController.m @@ -47,7 +47,7 @@ - (void)viewDidLoad - (void)setNavigationBarVisibility:(GKFadeNavigationControllerNavigationBarVisibility)navigationBarVisibility animated:(BOOL)animated { if (_navigationBarVisibility == navigationBarVisibility) { - NSLog(@"Changing navigaiton bar is not required"); + // NSLog(@"Changing navigaiton bar is not required"); return; } @@ -159,29 +159,16 @@ - (UIStatusBarStyle)preferredStatusBarStyle } } -#pragma mark - Navigation Controller overrides - -- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated -{ - [super pushViewController:viewController animated:animated]; - [self updateNavigationBarVisibilityForController:viewController animated:animated]; -} - -- (UIViewController *)popViewControllerAnimated:(BOOL)animated -{ - UIViewController *viewController = [super popViewControllerAnimated:animated]; - [self updateNavigationBarVisibilityForController:self.topViewController animated:animated]; - return viewController; -} - #pragma mark - - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { + [self updateNavigationBarVisibilityForController:viewController animated:animated]; + // This code is responsible for adjusting the correct navigation bar style when the user starts a side swipe gesture, but does not finish it. id transitionCoordinator = navigationController.topViewController.transitionCoordinator; [transitionCoordinator notifyWhenInteractionEndsUsingBlock:^(id context) { - + if ([context isCancelled]) { UIViewController *sourceViewController = [context viewControllerForKey:UITransitionContextFromViewControllerKey]; [self updateNavigationBarVisibilityForController:sourceViewController animated:NO];