From dd37824817b4180542ac88a06012f97140b5530f Mon Sep 17 00:00:00 2001 From: Andrea Cremaschi Date: Fri, 12 Sep 2014 17:07:59 +0200 Subject: [PATCH] update the model layer with the final state in case inAnimation and outAnimation are just simple CABasicAnimations --- ADTransitionController.podspec | 20 +++++++++++++++++++ .../ADTransitionController.m | 13 ++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 ADTransitionController.podspec diff --git a/ADTransitionController.podspec b/ADTransitionController.podspec new file mode 100644 index 0000000..0f71752 --- /dev/null +++ b/ADTransitionController.podspec @@ -0,0 +1,20 @@ +Pod::Spec.new do |s| + s.name = "ADTransitionController" + s.version = "1.1.0" + s.summary = "Drop-in replacement for UINavigationController with custom transition animations." + + s.description = <<-DESC + ADTransitionController is a drop-in replacement for UINavigationController with custom transition animations. Concept was described on Applidium's [website][http://applidium.com/en/news/uinavigationcontroller_with_custom_transitions/]. + DESC + + s.homepage = "http://applidium.github.io/ADTransitionController/" + s.screenshots = "http://applidium.com/en/news/uinavigationcontroller_with_custom_transitions/adtransitioncontroller.jpg?13739936" + s.license = { :type => "NetBSD", :file => "LICENSE" } + s.authors = { "Applidium" => "contact@applidium.com" } + s.platform = :ios, "6.0" + s.source = { :git => "https://github.com/applidium/ADTransitionController.git", :tag => "v1.1.0" } + s.source_files = "ADTransitionController/**/*.{h,m}" + s.exclude_files = "TransitionDemo/**/*.{h,m}" + s.framework = "QuartzCore" + s.requires_arc = false +end diff --git a/ADTransitionController/ADTransitionController.m b/ADTransitionController/ADTransitionController.m index 544b01f..fd4c75b 100644 --- a/ADTransitionController/ADTransitionController.m +++ b/ADTransitionController/ADTransitionController.m @@ -526,6 +526,19 @@ - (void)_transitionfromView:(UIView *)viewOut toView:(UIView *)viewIn withTransi ADDualTransition * dualTransition = (ADDualTransition *)transition; [viewIn.layer addAnimation:dualTransition.inAnimation forKey:nil]; [viewOut.layer addAnimation:dualTransition.outAnimation forKey:nil]; + + // If in and out animation are just CABasicAnimation + // we can easily set the final state to the model layer. + // If not, something should be made.. TODO: handle this situation! + if ([dualTransition.inAnimation isKindOfClass:[CABasicAnimation class]]) { + CABasicAnimation *inAnimation = transition.type == ADTransitionTypePush ? dualTransition.inAnimation : dualTransition.outAnimation; + [viewIn.layer setValue:[inAnimation toValue] forKeyPath:[inAnimation keyPath]]; + } + if ([dualTransition.outAnimation isKindOfClass:[CABasicAnimation class]]) { + CABasicAnimation *outAnimation = transition.type == ADTransitionTypePush ? dualTransition.outAnimation : dualTransition.inAnimation; + [viewOut.layer setValue:[outAnimation toValue] forKeyPath:[outAnimation keyPath]]; + } + } else if (transition != nil) { NSAssert(FALSE, @"Unhandled ADTransition subclass!"); }