From ce761bfaf17ba0272517571e749ba8843fc549c0 Mon Sep 17 00:00:00 2001 From: Boyce <910976804@qq.com> Date: Mon, 6 Jul 2015 03:32:14 +0800 Subject: [PATCH] ADD: add BCInteractiveTransition --- BCMagicTransition/BCInteractiveTransition.h | 28 ++++ BCMagicTransition/BCInteractiveTransition.m | 93 ++++++++++++ BCMagicTransition/BCMagicTransition.h | 4 +- BCMagicTransition/BCMagicTransition.m | 70 +++++---- .../UIViewController+BCMagicTransition.h | 11 +- .../UIViewController+BCMagicTransition.m | 136 +++++------------- Demo.xcodeproj/project.pbxproj | 13 ++ MagicTransition/FirstViewController.m | 2 +- 8 files changed, 227 insertions(+), 130 deletions(-) create mode 100644 BCMagicTransition/BCInteractiveTransition.h create mode 100644 BCMagicTransition/BCInteractiveTransition.m diff --git a/BCMagicTransition/BCInteractiveTransition.h b/BCMagicTransition/BCInteractiveTransition.h new file mode 100644 index 0000000..fddcac0 --- /dev/null +++ b/BCMagicTransition/BCInteractiveTransition.h @@ -0,0 +1,28 @@ +// +// BCInteractiveTransition.h +// Demo +// +// Created by Boyce Chang on 7/6/15. +// Copyright (c) 2015 Boyce Chang. All rights reserved. +// + +#import +#import + + +typedef NS_ENUM(NSInteger, BCInteractiveTransitionType) { + BCInteractiveTransitionTypeEdgePan = 0, + BCInteractiveTransitionTypeSwipeDown, +}; + + + +@interface BCInteractiveTransition : UIPercentDrivenInteractiveTransition + ++ (BCInteractiveTransition *)transitionWithType:(BCInteractiveTransitionType)type; + +@property (nonatomic, assign) BOOL interacting; + +- (void)addToViewController:(UIViewController*)viewController; + +@end diff --git a/BCMagicTransition/BCInteractiveTransition.m b/BCMagicTransition/BCInteractiveTransition.m new file mode 100644 index 0000000..0e514da --- /dev/null +++ b/BCMagicTransition/BCInteractiveTransition.m @@ -0,0 +1,93 @@ +// +// BCInteractiveTransition.m +// Demo +// +// Created by Boyce Chang on 7/6/15. +// Copyright (c) 2015 Boyce Chang. All rights reserved. +// + +#import "BCInteractiveTransition.h" + +@interface BCInteractiveTransition() + +@property (nonatomic, assign) BCInteractiveTransitionType type; + +@property (nonatomic, weak) UIViewController *presentingVC; +@property (nonatomic, strong) UIGestureRecognizer *gesture; + +@end + + +@implementation BCInteractiveTransition + ++ (BCInteractiveTransition *)transitionWithType:(BCInteractiveTransitionType)type { + BCInteractiveTransition *transition = [self new]; + transition.type = type; + + switch (type) { + case BCInteractiveTransitionTypeEdgePan: + { + UIScreenEdgePanGestureRecognizer *edgeGesture = [UIScreenEdgePanGestureRecognizer new]; + edgeGesture.edges = UIRectEdgeLeft; + transition.gesture = edgeGesture; + } + break; + default: + break; + } + + [transition.gesture addTarget:transition action:@selector(handleGestureRecognizer:)]; + transition.completionSpeed = 0.999; + + return transition; +} + +- (void)addToViewController:(UIViewController *)viewController { + _presentingVC = viewController; + [viewController.view addGestureRecognizer:self.gesture]; +} + + +#pragma mark - private method + +- (void)handleGestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer { + CGFloat progress; + + switch (self.type) { + case BCInteractiveTransitionTypeEdgePan: + progress = [gestureRecognizer translationInView:gestureRecognizer.view.superview].x / self.presentingVC.view.bounds.size.width; + break; + default: + break; + } + + progress = fminf(fmaxf(progress, 0.0), 1.0); + [self handleProgress:progress]; +} + +- (void)handleProgress:(float)progress { + switch (self.gesture.state) { + case UIGestureRecognizerStateBegan: + self.interacting = YES; + [self.presentingVC.navigationController popViewControllerAnimated:YES]; + break; + case UIGestureRecognizerStateChanged: + [self updateInteractiveTransition:progress]; + break; + case UIGestureRecognizerStateEnded: + case UIGestureRecognizerStateCancelled: + // Gesture over. Check if the transition should happen or not + self.interacting = NO; + + if (progress <= 0.4 || self.gesture.state == UIGestureRecognizerStateCancelled) { + [self cancelInteractiveTransition]; + } else { + [self finishInteractiveTransition]; + } + break; + default: + break; + } +} + +@end diff --git a/BCMagicTransition/BCMagicTransition.h b/BCMagicTransition/BCMagicTransition.h index f2c47fb..623352c 100755 --- a/BCMagicTransition/BCMagicTransition.h +++ b/BCMagicTransition/BCMagicTransition.h @@ -2,8 +2,8 @@ // BCMagicTransition.h // BCMagicTransition // -// Created by Xaiobo Zhang on 10/21/14. -// Copyright (c) 2014 Xaiobo Zhang. All rights reserved. +// Created by Boyce Chang on 10/21/14. +// Copyright (c) 2014 Boyce Chang. All rights reserved. // diff --git a/BCMagicTransition/BCMagicTransition.m b/BCMagicTransition/BCMagicTransition.m index 815ff96..81d27d6 100755 --- a/BCMagicTransition/BCMagicTransition.m +++ b/BCMagicTransition/BCMagicTransition.m @@ -34,9 +34,19 @@ - (void)animateTransition:(id )transitionC } #pragma mark - private +- (UIImage *)getImageFromView:(UIView *)view { + UIGraphicsBeginImageContextWithOptions(view.bounds.size, NO, 0.0); + [view.layer renderInContext:UIGraphicsGetCurrentContext()]; + + UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); + + UIGraphicsEndImageContext(); + return image; +} + - (void)defaultAnimationFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController containerView:(UIView *)containerView duration:(NSTimeInterval)duration transitionContext:(id )transitionContext { - float deviation = (self.isPush)?1.0f:-1.0f; + float deviation = (self.isPush) ? 1.0f : -1.0f; CGRect newFrame = toViewController.view.frame; newFrame.origin.x += newFrame.size.width*deviation; @@ -67,44 +77,52 @@ - (void)magicAnimationFromViewController:(UIViewController *)fromViewController NSMutableArray *fromViewSnapshotArray = [[NSMutableArray alloc] init]; for (UIView *fromView in self.fromViews) { - UIView *fromViewSnapshot = [fromView snapshotViewAfterScreenUpdates:NO]; + UIImageView *fromViewSnapshot = [[UIImageView alloc] initWithImage:[self getImageFromView:fromView]]; fromViewSnapshot.frame = [containerView convertRect:fromView.frame fromView:fromView.superview]; - fromView.hidden = YES; [fromViewSnapshotArray addObject:fromViewSnapshot]; + fromView.alpha = 0.0; } toViewController.view.frame = [transitionContext finalFrameForViewController:toViewController]; toViewController.view.alpha = 0; + [containerView addSubview:toViewController.view]; for (UIView *toView in self.toViews) { - toView.hidden = YES; + toView.alpha = 0.0; } - [containerView addSubview:toViewController.view]; - for (NSUInteger i = [fromViewSnapshotArray count]; i > 0; i--) { - [containerView addSubview:[fromViewSnapshotArray objectAtIndex:i-1]]; + [containerView addSubview:[fromViewSnapshotArray objectAtIndex:i - 1]]; } - [UIView animateWithDuration:duration delay:0.0 usingSpringWithDamping:0.7 initialSpringVelocity:0.8 options:UIViewAnimationOptionCurveEaseInOut animations:^{ - toViewController.view.alpha = 1.0; - for (NSUInteger i = 0; i < [self.fromViews count]; i++) { - UIView *toView = [self.toViews objectAtIndex:i]; - UIView *fromViewSnapshot = [fromViewSnapshotArray objectAtIndex:i]; - CGRect frame = [containerView convertRect:toView.frame fromView:toView.superview]; - fromViewSnapshot.frame = frame; - } - } completion:^(BOOL finished) { - for (NSUInteger i = 0; i < [self.fromViews count]; i++) { - UIView *toView = [self.toViews objectAtIndex:i]; - UIView *fromView = [self.fromViews objectAtIndex:i]; - UIView *fromViewSnapshot = [fromViewSnapshotArray objectAtIndex:i]; - toView.hidden = NO; - fromView.hidden = NO; - [fromViewSnapshot removeFromSuperview]; - } - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }]; + [UIView animateWithDuration:duration + delay:0.0 + usingSpringWithDamping:0.6 + initialSpringVelocity:0.0 + options:UIViewAnimationOptionCurveEaseInOut + animations:^{ + toViewController.view.alpha = 1.0; + for (NSUInteger i = 0; i < [self.fromViews count]; i++) { + UIView *toView = [self.toViews objectAtIndex:i]; + UIView *fromViewSnapshot = [fromViewSnapshotArray objectAtIndex:i]; + CGRect frame = [containerView convertRect:toView.frame fromView:toView.superview]; + fromViewSnapshot.frame = frame; + } + } completion:^(BOOL finished) { + for (NSUInteger i = 0; i < [self.fromViews count]; i++) { + UIView *toView = [self.toViews objectAtIndex:i]; + UIView *fromView = [self.fromViews objectAtIndex:i]; + UIView *fromViewSnapshot = [fromViewSnapshotArray objectAtIndex:i]; + toView.alpha = 1.0; + fromView.alpha = 1.0; + [fromViewSnapshot removeFromSuperview]; + } + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0.1), ^{ + [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; + }); + //[transitionContext completeTransition:![transitionContext transitionWasCancelled]]; + }]; } @end diff --git a/BCMagicTransition/UIViewController+BCMagicTransition.h b/BCMagicTransition/UIViewController+BCMagicTransition.h index b80ed23..0c09169 100644 --- a/BCMagicTransition/UIViewController+BCMagicTransition.h +++ b/BCMagicTransition/UIViewController+BCMagicTransition.h @@ -2,13 +2,18 @@ // UIViewController+BCMagicTransition.h // Demo // -// Created by Nikhil Nigade on 6/4/15. -// Copyright (c) 2015 Boyce. All rights reserved. +// Created by Boyce Chang on 6/4/15. +// Copyright (c) 2015 Boyce Chang. All rights reserved. // -#import "BCMagicTransition.h" // Conform to this protocol on a viewController which utilizes BCMagicTransition. ViewControllers which don't will not be affected. + +#import +#import + +@class BCMagicTransition; + @protocol BCMagicTransitionProtocol @end diff --git a/BCMagicTransition/UIViewController+BCMagicTransition.m b/BCMagicTransition/UIViewController+BCMagicTransition.m index 19d60ba..2832235 100644 --- a/BCMagicTransition/UIViewController+BCMagicTransition.m +++ b/BCMagicTransition/UIViewController+BCMagicTransition.m @@ -6,9 +6,14 @@ // Copyright (c) 2015 Boyce. All rights reserved. // -#import "UIViewController+BCMagicTransition.h" #import +#import "UIViewController+BCMagicTransition.h" + +#import "BCMagicTransition.h" + +#import "BCInteractiveTransition.h" + static char kPopTransit; static char kPushTransit; static char kInteractivePopTransition; @@ -22,14 +27,12 @@ @implementation UIViewController (BCMagicTransition) #pragma mark - Swizzled Methods -- (void)dz_viewDidAppear:(BOOL)animated -{ +- (void)dz_viewDidAppear:(BOOL)animated { [self dz_viewDidAppear:animated]; - NSLog(@"%@ dz_viewDidAppear:", NSStringFromClass([self class])); + // Set outself as the navigation controller's delegate so we're asked for a transitioning object - if (self.popTransit) - { + if (self.popTransit) { self.navigationController.delegate = self; } @@ -38,18 +41,17 @@ - (void)dz_viewDidAppear:(BOOL)animated - (void)dz_viewWillDisappear:(BOOL)animated { [self dz_viewWillDisappear:animated]; - NSLog(@"%@ dz_viewWillDisappear:", NSStringFromClass([self class])); + // Stop being the navigation controller's delegate - if (self.navigationController.delegate == self) - { + if (self.navigationController.delegate == self) { self.navigationController.delegate = nil; } } #pragma mark - Class Methods -+ (void)load -{ ++ (void)load { + [super load]; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ @@ -71,40 +73,31 @@ + (void)load } }); - } #pragma mark - Properties -- (UIPercentDrivenInteractiveTransition *)interactivePopTransition -{ +- (UIPercentDrivenInteractiveTransition *)interactivePopTransition { return objc_getAssociatedObject(self, &kInteractivePopTransition); } -- (void)setInteractivePopTransition:(UIPercentDrivenInteractiveTransition *)value -{ +- (void)setInteractivePopTransition:(UIPercentDrivenInteractiveTransition *)value { objc_setAssociatedObject(self, &kInteractivePopTransition, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } -- (BCMagicTransition *)popTransit -{ +- (BCMagicTransition *)popTransit { return objc_getAssociatedObject(self, &kPopTransit); } -- (void)setPopTransit:(BCMagicTransition *)value -{ - +- (void)setPopTransit:(BCMagicTransition *)value { objc_setAssociatedObject(self, &kPopTransit, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); - } -- (BCMagicTransition *)pushTransit -{ +- (BCMagicTransition *)pushTransit { return objc_getAssociatedObject(self, &kPushTransit); } -- (void)setPushTransit:(BCMagicTransition *)value -{ +- (void)setPushTransit:(BCMagicTransition *)value { objc_setAssociatedObject(self, &kPushTransit, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } @@ -116,9 +109,7 @@ - (void)pushViewController:(UIViewController *)viewController toView:(UIView *)toView duration:(NSTimeInterval)duration { - NSArray *fromViews = [NSArray arrayWithObject:fromView]; - NSArray *toViews = [NSArray arrayWithObject:toView]; - [self pushViewController:viewController fromViews:fromViews toViews:toViews duration:duration]; + [self pushViewController:viewController fromViews:@[fromView] toViews:@[toView] duration:duration]; } - (void)pushViewController:(UIViewController *)viewController @@ -126,6 +117,7 @@ - (void)pushViewController:(UIViewController *)viewController toViews:(NSArray *)toViews duration:(NSTimeInterval)duration { + // Add push animation to self BCMagicTransition *magicPush = [BCMagicTransition new]; magicPush.isMagic = YES; magicPush.isPush = YES; @@ -136,11 +128,9 @@ - (void)pushViewController:(UIViewController *)viewController self.navigationController.delegate = self; // Add pop gesture and animation to viewcontroller - UIViewController *transitVC = viewController; - - UIScreenEdgePanGestureRecognizer *popRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(handleEdgePanGestureRecognizer:)]; - popRecognizer.edges = UIRectEdgeLeft; - [transitVC.view addGestureRecognizer:popRecognizer]; + BCInteractiveTransition *interactiveTransition = [BCInteractiveTransition transitionWithType:BCInteractiveTransitionTypeEdgePan]; + [interactiveTransition addToViewController:viewController]; + viewController.interactivePopTransition = interactiveTransition; BCMagicTransition *magicPop = [BCMagicTransition new]; magicPop.isMagic = YES; @@ -148,20 +138,18 @@ - (void)pushViewController:(UIViewController *)viewController magicPop.duration = duration; magicPop.fromViews = toViews; magicPop.toViews = fromViews; - transitVC.popTransit = magicPop; + viewController.popTransit = magicPop; - [self.navigationController pushViewController:transitVC animated:YES]; + [self.navigationController pushViewController:viewController animated:YES]; } #pragma mark - -- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated { - - if ([viewController conformsToProtocol:NSProtocolFromString(@"BCMagicTransitionProtocol")]) - { +- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated +{ + if ([viewController conformsToProtocol:NSProtocolFromString(@"BCMagicTransitionProtocol")]) { [(UIViewController *)viewController setPushTransit:nil]; } - } - (id)navigationController:(UINavigationController *)navigationController @@ -171,41 +159,27 @@ - (void)navigationController:(UINavigationController *)navigationController didS { switch (operation) { case UINavigationControllerOperationPush: - { - - if ([fromVC conformsToProtocol:NSProtocolFromString(@"BCMagicTransitionProtocol")] && [fromVC pushTransit]) - { + if ([fromVC conformsToProtocol:NSProtocolFromString(@"BCMagicTransitionProtocol")] && [fromVC pushTransit]) { return [fromVC pushTransit]; - } - else - { + } else { BCMagicTransition *normalPush = [BCMagicTransition new]; normalPush.isMagic = NO; normalPush.isPush = YES; normalPush.duration = DEFAULT_TRANSITON_DURATION; return normalPush; } - - } break; case UINavigationControllerOperationPop: - { - - if ([fromVC conformsToProtocol:NSProtocolFromString(@"BCMagicTransitionProtocol")] && [fromVC popTransit]) - { + if ([fromVC conformsToProtocol:NSProtocolFromString(@"BCMagicTransitionProtocol")] && [fromVC popTransit]) { return [fromVC popTransit]; - } - else - { + } else { BCMagicTransition *normalPop = [BCMagicTransition new]; normalPop.isMagic = NO; normalPop.isPush = NO; normalPop.duration = DEFAULT_TRANSITON_DURATION; return normalPop; } - - } break; default: return nil; @@ -216,47 +190,13 @@ - (void)navigationController:(UINavigationController *)navigationController didS - (id)navigationController:(UINavigationController *)navigationController interactionControllerForAnimationController:(id)animationController { - - if ([navigationController.topViewController conformsToProtocol:NSProtocolFromString(@"BCMagicTransitionProtocol")]) - { - UIViewController *viewController = navigationController.topViewController; - return viewController.interactivePopTransition; + BCMagicTransition *magicTransition = animationController; + if ([self conformsToProtocol:NSProtocolFromString(@"BCMagicTransitionProtocol")] && !magicTransition.isPush) { + BCInteractiveTransition *interactiveTransition = (BCInteractiveTransition *)self.interactivePopTransition; + return interactiveTransition.interacting ? interactiveTransition : nil; } return nil; - -} - -- (void)handleEdgePanGestureRecognizer:(UIScreenEdgePanGestureRecognizer*)recognizer -{ - - CGFloat progress = [recognizer translationInView:self.view].x / (self.view.bounds.size.width * 0.99); - progress = MIN(0.99, MAX(0.0, progress)); - - if (recognizer.state == UIGestureRecognizerStateBegan) - { - self.interactivePopTransition = [[UIPercentDrivenInteractiveTransition alloc] init]; - [self.navigationController popViewControllerAnimated:YES]; - - } - else if (recognizer.state == UIGestureRecognizerStateChanged) - { - - [self.interactivePopTransition updateInteractiveTransition:progress]; - - } - else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) - { - // Finish or cancel the interactive transition - if (progress > 0.4) { - [self.interactivePopTransition finishInteractiveTransition]; - } else { - [self.interactivePopTransition cancelInteractiveTransition]; - } - - //self.interactivePopTransition = nil; - } - } - + @end diff --git a/Demo.xcodeproj/project.pbxproj b/Demo.xcodeproj/project.pbxproj index b1efc72..d04f3cc 100644 --- a/Demo.xcodeproj/project.pbxproj +++ b/Demo.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ E17EDD181A03C6220097DD5C /* SecondViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E17EDD161A03C6220097DD5C /* SecondViewController.m */; }; E17EDD191A03C6220097DD5C /* SecondViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E17EDD171A03C6220097DD5C /* SecondViewController.xib */; }; E17EDD1B1A03C6C80097DD5C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E17EDD1A1A03C6C80097DD5C /* UIKit.framework */; }; + E1B2DE6D1B498F1C00F866E6 /* BCInteractiveTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = E1B2DE6C1B498F1C00F866E6 /* BCInteractiveTransition.m */; }; F05986AD1B203D36004C2C06 /* UIViewController+BCMagicTransition.m in Sources */ = {isa = PBXBuildFile; fileRef = F05986AC1B203D36004C2C06 /* UIViewController+BCMagicTransition.m */; }; /* End PBXBuildFile section */ @@ -42,6 +43,8 @@ E17EDD161A03C6220097DD5C /* SecondViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SecondViewController.m; sourceTree = ""; }; E17EDD171A03C6220097DD5C /* SecondViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SecondViewController.xib; sourceTree = ""; }; E17EDD1A1A03C6C80097DD5C /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + E1B2DE6B1B498F1C00F866E6 /* BCInteractiveTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BCInteractiveTransition.h; path = BCMagicTransition/BCInteractiveTransition.h; sourceTree = ""; }; + E1B2DE6C1B498F1C00F866E6 /* BCInteractiveTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BCInteractiveTransition.m; path = BCMagicTransition/BCInteractiveTransition.m; sourceTree = ""; }; F05986AB1B203D36004C2C06 /* UIViewController+BCMagicTransition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIViewController+BCMagicTransition.h"; path = "BCMagicTransition/UIViewController+BCMagicTransition.h"; sourceTree = ""; }; F05986AC1B203D36004C2C06 /* UIViewController+BCMagicTransition.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+BCMagicTransition.m"; path = "BCMagicTransition/UIViewController+BCMagicTransition.m"; sourceTree = ""; }; /* End PBXFileReference section */ @@ -63,6 +66,8 @@ children = ( E138B7E51AD50C4000843CCA /* BCMagicTransition.h */, E138B7E61AD50C4000843CCA /* BCMagicTransition.m */, + E1B2DE6B1B498F1C00F866E6 /* BCInteractiveTransition.h */, + E1B2DE6C1B498F1C00F866E6 /* BCInteractiveTransition.m */, F05986AB1B203D36004C2C06 /* UIViewController+BCMagicTransition.h */, F05986AC1B203D36004C2C06 /* UIViewController+BCMagicTransition.m */, ); @@ -173,6 +178,7 @@ TargetAttributes = { E17EDCDC1A03C5890097DD5C = { CreatedOnToolsVersion = 6.1; + DevelopmentTeam = UXQ4US7LL6; }; }; }; @@ -219,6 +225,7 @@ E17EDD181A03C6220097DD5C /* SecondViewController.m in Sources */, E17EDCE61A03C5890097DD5C /* AppDelegate.m in Sources */, E17EDCE31A03C5890097DD5C /* main.m in Sources */, + E1B2DE6D1B498F1C00F866E6 /* BCInteractiveTransition.m in Sources */, E138B7E91AD50C4000843CCA /* BCMagicTransition.m in Sources */, E138B7EE1AD5140300843CCA /* ThirdViewController.m in Sources */, ); @@ -318,10 +325,13 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = MagicTransition/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = Demo; + PROVISIONING_PROFILE = ""; }; name = Debug; }; @@ -329,10 +339,13 @@ isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; INFOPLIST_FILE = MagicTransition/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_NAME = Demo; + PROVISIONING_PROFILE = ""; }; name = Release; }; diff --git a/MagicTransition/FirstViewController.m b/MagicTransition/FirstViewController.m index 54de520..19490a4 100644 --- a/MagicTransition/FirstViewController.m +++ b/MagicTransition/FirstViewController.m @@ -28,7 +28,7 @@ - (void)didReceiveMemoryWarning { - (IBAction)push:(id)sender { SecondViewController *secondVC = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; - // preload views to the memory and get thue frames + // preload views to the memory [secondVC view]; // setup fromviews array and toviews array