├── .gitignore ├── LICENSE ├── Modality.podspec ├── Modality ├── Categories │ ├── UIViewController+Modality.h │ └── UIViewController+Modality.m ├── Definitions │ ├── MODDefaults.h │ ├── MODDirection.h │ └── MODTransitionType.h ├── Factories │ ├── MODTransformFactory.h │ └── MODTransformFactory.m ├── Helpers │ ├── MODModalHelper.h │ ├── MODModalHelper.m │ ├── MODPropertiesHelper.h │ ├── MODPropertiesHelper.m │ ├── MODViewHelper.h │ └── MODViewHelper.m ├── Protocols │ └── MODTransitionAnimator.h └── Transitioning │ ├── Base │ ├── MODDirectionalTransitioningBase.h │ ├── MODDirectionalTransitioningBase.m │ ├── MODModalTransitioningBase.h │ ├── MODModalTransitioningBase.m │ ├── MODTransitioningBase.h │ └── MODTransitioningBase.m │ └── TransitionAnimators │ ├── MODTransitionAnimatorCarryOver.h │ ├── MODTransitionAnimatorCarryOver.m │ ├── MODTransitionAnimatorFade.h │ ├── MODTransitionAnimatorFade.m │ ├── MODTransitionAnimatorFlipModal.h │ ├── MODTransitionAnimatorFlipModal.m │ ├── MODTransitionAnimatorMask.h │ ├── MODTransitionAnimatorMask.m │ ├── MODTransitionAnimatorSlideModal.h │ └── MODTransitionAnimatorSlideModal.m ├── ModalityExample ├── ModalityExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── ModalityExample │ ├── Application │ │ ├── AppDelegate.h │ │ └── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── circleMask.imageset │ │ │ ├── Contents.json │ │ │ └── circleMask.png │ │ ├── logo.imageset │ │ │ ├── Contents.json │ │ │ └── logoBig.png │ │ └── starMask.imageset │ │ │ ├── Contents.json │ │ │ └── starMask.png │ ├── Info.plist │ ├── ViewControllers │ │ ├── CarryOverViewController.h │ │ ├── CarryOverViewController.m │ │ ├── FadeViewController.h │ │ ├── FadeViewController.m │ │ ├── TableViewController.h │ │ └── TableViewController.m │ ├── Views │ │ ├── CellContentView.h │ │ ├── CellContentView.m │ │ ├── DIrectionLabel.h │ │ ├── DIrectionLabel.m │ │ ├── DirectionButton.h │ │ └── DirectionButton.m │ └── main.m └── ModalityExampleTests │ ├── Info.plist │ └── ModalityExampleTests.m └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Kevin Wong 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 | 23 | -------------------------------------------------------------------------------- /Modality.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'Modality' 3 | s.version = '0.0.1' 4 | s.authors = {'Kevin Wong' => 'kevin.wl.02@gmail.com'} 5 | s.summary = 'View focused transitions library. (Modals and other custom transitions)' 6 | s.homepage = 'https://github.com/kevinwl02/Modality.git' 7 | s.license = { :type => "MIT", :file => "LICENSE" } 8 | s.platform = :ios, '8.0' 9 | s.source = {:git => 'https://github.com/kevinwl02/Modality.git', :tag => '0.0.1'} 10 | s.source_files = 'Modality/**/*.{h,m,mm}', 'Modality/**/**/*.{h,m,mm}' 11 | s.requires_arc = true 12 | end -------------------------------------------------------------------------------- /Modality/Categories/UIViewController+Modality.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Modality.h 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODTransitionAnimator.h" 11 | #import "MODDefaults.h" 12 | 13 | /** 14 | * Main interface from which transitions are set up. 15 | * Always use these methods to animate with transition animators. 16 | */ 17 | @interface UIViewController (Modality) 18 | 19 | /** 20 | * Presents a view controller using the specified transition 21 | * configuration. 22 | * 23 | * @param viewController The view controller to present 24 | * @param transitionAnimator The transition animator object 25 | * @param duration The duration of the transition 26 | * @param completion Completion handler for the transition 27 | */ 28 | - (void)MOD_presentViewController:(UIViewController *)viewController 29 | withTransitionAnimator:(id)transitionAnimator 30 | duration:(CGFloat)duration 31 | completion:(void(^)())completion; 32 | 33 | /** 34 | * Sets up a transition configuration for a view controller. 35 | * Use this to set up the destination view controllers when 36 | * presenting from a segue. 37 | * 38 | * @param transitionAnimator The transition animator object 39 | * @param duration The duration of the transition 40 | */ 41 | - (void)MOD_animateWithTransitionAnimator:(id)transitionAnimator 42 | duration:(CGFloat)duration; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Modality/Categories/UIViewController+Modality.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewController+Modality.m 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "UIViewController+Modality.h" 10 | #import 11 | #import "MODDefaults.h" 12 | #import "MODTransitionAnimator.h" 13 | 14 | static char * const kTransitioningDelegateAssociationKey = "MODTransitionAnimatorAssociationKey"; 15 | 16 | @implementation UIViewController (Modality) 17 | 18 | - (void)MOD_presentViewController:(UIViewController *)viewController 19 | withTransitionAnimator:(id)transitionAnimator 20 | duration:(CGFloat)duration 21 | completion:(void(^)())completion { 22 | 23 | [self setupDestinationViewController:viewController 24 | withTransitionAnimator:transitionAnimator 25 | duration:duration]; 26 | [self presentViewController:viewController animated:YES completion:completion]; 27 | } 28 | 29 | - (void)MOD_animateWithTransitionAnimator:(id)transitionAnimator 30 | duration:(CGFloat)duration { 31 | 32 | [self setupDestinationViewController:self 33 | withTransitionAnimator:transitionAnimator 34 | duration:duration]; 35 | } 36 | 37 | - (void)setupDestinationViewController:(UIViewController *)destinationViewController 38 | withTransitionAnimator:(id)transitionAnimator 39 | duration:(CGFloat)duration { 40 | 41 | switch (transitionAnimator.transitionType) { 42 | case MODTransitionTypeFullScreen: 43 | break; 44 | case MODTransitionTypeModal: 45 | destinationViewController.modalPresentationStyle = UIModalPresentationCustom; 46 | break; 47 | 48 | default: 49 | break; 50 | } 51 | 52 | transitionAnimator.transitionDuration = duration; 53 | destinationViewController.transitioningDelegate = transitionAnimator; 54 | objc_setAssociatedObject(destinationViewController, kTransitioningDelegateAssociationKey, transitionAnimator, OBJC_ASSOCIATION_RETAIN); 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Modality/Definitions/MODDefaults.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODDefaults.h 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | /** 10 | * Default flag for transition duration 11 | */ 12 | static CGFloat const MODDefaulTransitionDuration = -1; 13 | -------------------------------------------------------------------------------- /Modality/Definitions/MODDirection.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODDirection.m 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * Direction attribute for modal transitions 13 | */ 14 | typedef NS_ENUM (NSInteger, MODDirection) { 15 | 16 | MODDirectionTop, 17 | MODDirectionBottom, 18 | MODDirectionLeft, 19 | MODDirectionRight 20 | }; -------------------------------------------------------------------------------- /Modality/Definitions/MODTransitionType.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionType.h 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 12 | * Determines if the view controller that initiates the 13 | * transition will stay on screen after the transition is 14 | * completed. 15 | */ 16 | typedef NS_ENUM(NSInteger, MODTransitionType) { 17 | 18 | /** 19 | * Initial view controller won't stay. 20 | */ 21 | MODTransitionTypeFullScreen, 22 | 23 | /** 24 | * Initial view controller will stay. 25 | */ 26 | MODTransitionTypeModal 27 | }; 28 | -------------------------------------------------------------------------------- /Modality/Factories/MODTransformFactory.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransformFactory.h 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODDirection.h" 11 | 12 | /** 13 | * Utility class for creating transforms. 14 | * This is only used inside the transition animator classes. 15 | */ 16 | @interface MODTransformFactory : NSObject 17 | 18 | /** 19 | * Returns a CGAffineTransform translated to the 20 | * specified direction. 21 | * 22 | * @param transform The initial transform to which the 23 | * translation will be applied 24 | * @param distance The distance of the translation 25 | * @param direction The direction of the translation 26 | * 27 | * @return The calculated transform 28 | */ 29 | + (CGAffineTransform)translateTransformWithTransform:(CGAffineTransform)transform distance:(NSInteger)distance direction:(MODDirection)direction; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Modality/Factories/MODTransformFactory.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransformFactory.m 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransformFactory.h" 10 | #import "MODPropertiesHelper.h" 11 | 12 | @implementation MODTransformFactory 13 | 14 | + (CGAffineTransform)translateTransformWithTransform:(CGAffineTransform)transform distance:(NSInteger)distance direction:(MODDirection)direction { 15 | 16 | CGFloat translateX = [MODPropertiesHelper signForXAxisWithDirection:direction] * distance; 17 | CGFloat translateY = [MODPropertiesHelper signForYAxisWithDirection:direction] * distance; 18 | 19 | return CGAffineTransformTranslate(transform, translateX, translateY); 20 | } 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /Modality/Helpers/MODModalHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODModalHelper.h 3 | // Modality 4 | // 5 | // Created by Kevin on 15/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODDirection.h" 11 | 12 | /** 13 | * Helper class for configuring modal animations. 14 | * This is mainly used in the transition animator classes. 15 | */ 16 | @interface MODModalHelper : NSObject 17 | 18 | /** 19 | * Sets up the autolayout options of a view based on length 20 | * and specified direction. 21 | * 22 | * @param view The view to autolayout 23 | * @param containerView The super view 24 | * @param length The length to which constraint the view 25 | * @param direction The direction where the view should be 26 | * placed 27 | * @param offset An additional offset for the view's 28 | * position 29 | * 30 | * @return The generated constraint related to the direction 31 | */ 32 | + (NSLayoutConstraint *)setupFrameForView:(UIView *)view inContainerView:(UIView *)containerView withLength:(CGFloat)length andDirection:(MODDirection)direction offset:(CGFloat)offset; 33 | 34 | /** 35 | * Adds a background for modal transitions. This background 36 | * will dismiss the destination view controller when it is 37 | * tapped. 38 | * 39 | * @param view The view that will contain 40 | * the background 41 | * @param duration The duration of the animation 42 | * @param alpha The final alpha of the background 43 | * @param destinationViewController The view controller that 44 | * will be dismissed upon tapping the background view 45 | */ 46 | + (void)addModalBackgroundAnimationToView:(UIView *)view withDuration:(CGFloat)duration alpha:(CGFloat)alpha destinationViewController:(UIViewController *)destinationViewController; 47 | 48 | /** 49 | * Removes the modal background from a view. 50 | * 51 | * @param view The view which contains a modal background 52 | * @param duration The duration of the animation 53 | */ 54 | + (void)removeModalBackgroundAnimationFromView:(UIView *)view withDuration:(CGFloat)duration; 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /Modality/Helpers/MODModalHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODModalHelper.m 3 | // Modality 4 | // 5 | // Created by Kevin on 15/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODModalHelper.h" 10 | #import "MODViewHelper.h" 11 | #import "MODPropertiesHelper.h" 12 | #import 13 | 14 | static CGFloat const kMinModalSpace = 45; 15 | static NSInteger const kModalBackgroundTag = 559; 16 | static char * const kTapGestureTargetControllerAssociationKey = "tapGestureTargetControllerAssociationKey"; 17 | 18 | @implementation MODModalHelper 19 | 20 | + (NSLayoutConstraint *)setupFrameForView:(UIView *)view inContainerView:(UIView *)containerView withLength:(CGFloat)length andDirection:(MODDirection)direction offset:(CGFloat)offset { 21 | 22 | view.frame = CGRectMake(0, 0, length, length); 23 | view.translatesAutoresizingMaskIntoConstraints = NO; 24 | 25 | CGFloat widthOffset = [MODPropertiesHelper signForXAxisWithDirection:direction] * offset * length * -1; 26 | CGFloat heightOffset = [MODPropertiesHelper signForYAxisWithDirection:direction] * offset * length * -1; 27 | 28 | switch (direction) { 29 | case MODDirectionTop: 30 | [MODViewHelper layoutTransformFrameSetHorizontalForView:view]; 31 | [MODViewHelper layoutTransformFrameSetHeightForView:view withPriority:UILayoutPriorityDefaultHigh]; 32 | [MODViewHelper layoutTransformFrameSetGreaterOrEqualThan:kMinModalSpace forAttribute:NSLayoutAttributeBottom view:view]; 33 | return [MODViewHelper layoutTransformFrameSetEqualAttribute:NSLayoutAttributeTop forView:view constant:heightOffset]; 34 | case MODDirectionBottom: 35 | [MODViewHelper layoutTransformFrameSetHorizontalForView:view]; 36 | [MODViewHelper layoutTransformFrameSetHeightForView:view withPriority:UILayoutPriorityDefaultHigh]; 37 | [MODViewHelper layoutTransformFrameSetGreaterOrEqualThan:kMinModalSpace forAttribute:NSLayoutAttributeTop view:view]; 38 | return [MODViewHelper layoutTransformFrameSetEqualAttribute:NSLayoutAttributeBottom forView:view constant:heightOffset]; 39 | case MODDirectionLeft: 40 | [MODViewHelper layoutTransformFrameSetVerticalForView:view]; 41 | [MODViewHelper layoutTransformFrameSetWidthForView:view withPriority:UILayoutPriorityDefaultHigh]; 42 | [MODViewHelper layoutTransformFrameSetGreaterOrEqualThan:kMinModalSpace forAttribute:NSLayoutAttributeRight view:view]; 43 | return [MODViewHelper layoutTransformFrameSetEqualAttribute:NSLayoutAttributeLeft forView:view constant:widthOffset]; 44 | case MODDirectionRight: 45 | [MODViewHelper layoutTransformFrameSetVerticalForView:view]; 46 | [MODViewHelper layoutTransformFrameSetWidthForView:view withPriority:UILayoutPriorityDefaultHigh]; 47 | [MODViewHelper layoutTransformFrameSetGreaterOrEqualThan:kMinModalSpace forAttribute:NSLayoutAttributeLeft view:view]; 48 | return [MODViewHelper layoutTransformFrameSetEqualAttribute:NSLayoutAttributeRight forView:view constant:widthOffset]; 49 | 50 | default: 51 | return nil; 52 | } 53 | } 54 | 55 | + (void)addModalBackgroundAnimationToView:(UIView *)view withDuration:(CGFloat)duration alpha:(CGFloat)alpha destinationViewController:(UIViewController *)destinationViewController { 56 | 57 | UIView *modalBackground = [[UIView alloc] initWithFrame:view.frame]; 58 | modalBackground.backgroundColor = [UIColor blackColor]; 59 | modalBackground.alpha = 0; 60 | modalBackground.tag = kModalBackgroundTag; 61 | [view addSubview:modalBackground]; 62 | [MODViewHelper layoutDockIntoSuperviewForView:modalBackground]; 63 | 64 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(modalTapGestureTriggered:)]; 65 | [modalBackground addGestureRecognizer:tapGesture]; 66 | objc_setAssociatedObject(tapGesture, kTapGestureTargetControllerAssociationKey, destinationViewController, OBJC_ASSOCIATION_RETAIN); 67 | 68 | [UIView animateWithDuration:duration animations:^{ 69 | 70 | modalBackground.alpha = alpha; 71 | } completion:nil]; 72 | } 73 | 74 | + (void)removeModalBackgroundAnimationFromView:(UIView *)view withDuration:(CGFloat)duration { 75 | 76 | UIView *modalBackground = [view viewWithTag:kModalBackgroundTag]; 77 | 78 | [UIView animateWithDuration:duration animations:^{ 79 | 80 | modalBackground.alpha = 0; 81 | } completion:^(BOOL finished) { 82 | 83 | if (finished) { 84 | [modalBackground removeFromSuperview]; 85 | } 86 | }]; 87 | } 88 | 89 | #pragma mark - Private methods 90 | 91 | + (void)modalTapGestureTriggered:(UITapGestureRecognizer *)tapGesture { 92 | 93 | UIViewController *destinationViewController = objc_getAssociatedObject(tapGesture, kTapGestureTargetControllerAssociationKey); 94 | [destinationViewController dismissViewControllerAnimated:YES completion:nil]; 95 | } 96 | 97 | @end 98 | -------------------------------------------------------------------------------- /Modality/Helpers/MODPropertiesHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODPropertiesHelper.h 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODDirection.h" 11 | 12 | /** 13 | * Helper class for processing direction properties 14 | * This is mainly used in the transition animator classes. 15 | */ 16 | @interface MODPropertiesHelper : NSObject 17 | 18 | /** 19 | * Returns the inverse direction fot a given direction. 20 | * 21 | * @param direction The direction to inverse 22 | * 23 | * @return The inversed direction 24 | */ 25 | + (MODDirection)inverseDirectionForDirection:(MODDirection)direction; 26 | 27 | /** 28 | * Returns a reference length for a view based on direction. 29 | * 30 | * @param view The view to get the length from 31 | * @param direction The direction to which calculate the 32 | * the length 33 | * 34 | * @return The calculated length 35 | */ 36 | + (CGFloat)lengthOfView:(UIView *)view forDirection:(MODDirection)direction; 37 | 38 | /** 39 | * Returns a sign on the X axis for a direction based on 40 | * views coordinate space. 41 | * 42 | * @param direction The direction to get the sign from 43 | * 44 | * @return The calculated sign on the X axis 45 | */ 46 | + (NSInteger)signForXAxisWithDirection:(MODDirection)direction; 47 | 48 | /** 49 | * Returns a sign on the Y axis for a direction based on 50 | * views coordinate space. 51 | * 52 | * @param direction The direction to get the sign from 53 | * 54 | * @return The calculated sign on the Y axis 55 | */ 56 | + (NSInteger)signForYAxisWithDirection:(MODDirection)direction; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /Modality/Helpers/MODPropertiesHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODPropertiesHelper.m 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODPropertiesHelper.h" 10 | 11 | @implementation MODPropertiesHelper 12 | 13 | + (MODDirection)inverseDirectionForDirection:(MODDirection)direction { 14 | 15 | switch (direction) { 16 | case MODDirectionTop: 17 | return MODDirectionBottom; 18 | case MODDirectionBottom: 19 | return MODDirectionTop; 20 | case MODDirectionLeft: 21 | return MODDirectionRight; 22 | case MODDirectionRight: 23 | return MODDirectionLeft; 24 | 25 | default: 26 | return MODDirectionTop; 27 | } 28 | } 29 | 30 | + (CGFloat)lengthOfView:(UIView *)view forDirection:(MODDirection)direction { 31 | 32 | CGSize viewSize = view.bounds.size; 33 | 34 | switch (direction) { 35 | case MODDirectionTop: 36 | case MODDirectionBottom: 37 | return viewSize.height; 38 | case MODDirectionLeft: 39 | case MODDirectionRight: 40 | return viewSize.width; 41 | 42 | default: 43 | return 0; 44 | } 45 | } 46 | 47 | + (NSInteger)signForXAxisWithDirection:(MODDirection)direction { 48 | 49 | switch (direction) { 50 | case MODDirectionTop: 51 | case MODDirectionBottom: 52 | return 0; 53 | case MODDirectionLeft: 54 | return 1; 55 | case MODDirectionRight: 56 | return -1; 57 | 58 | default: 59 | return 0; 60 | } 61 | } 62 | 63 | + (NSInteger)signForYAxisWithDirection:(MODDirection)direction { 64 | 65 | switch (direction) { 66 | case MODDirectionTop: 67 | return 1; 68 | case MODDirectionBottom: 69 | return -1; 70 | case MODDirectionLeft: 71 | case MODDirectionRight: 72 | return 0; 73 | 74 | default: 75 | return 0;; 76 | } 77 | } 78 | 79 | @end 80 | -------------------------------------------------------------------------------- /Modality/Helpers/MODViewHelper.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODViewHelper.h 3 | // Modality 4 | // 5 | // Created by Kevin on 15/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODDirection.h" 11 | 12 | /** 13 | * Helper class for configuring views. 14 | * This is mainly used in the transition animator classes. 15 | */ 16 | @interface MODViewHelper : NSObject 17 | 18 | + (UIImageView *)snapshotCopyOfView:(UIView *)view; 19 | + (UIView *)onePixelLineStretchedSnapshotOfView:(UIView *)view withDirection:(MODDirection)direction; 20 | + (UIView *)viewWithBackgroundOfPixelAtPosition:(CGPoint)position inView:(UIView *)view; 21 | + (void)layoutView:(UIView *)view withFrame:(CGRect)frame inOptionalContainer:(UIView *)containerView; 22 | + (void)layoutDockIntoSuperviewForView:(UIView *)view; 23 | + (void)layoutTransformFrameSetHorizontalForView:(UIView *)view; 24 | + (void)layoutTransformFrameSetVerticalForView:(UIView *)view; 25 | + (NSLayoutConstraint *)layoutTransformFrameSetEqualAttribute:(NSLayoutAttribute)attribute forView:(UIView *)view constant:(CGFloat)constant; 26 | + (void)layoutTransformFrameSetWidthForView:(UIView *)view withPriority:(UILayoutPriority)priority; 27 | + (void)layoutTransformFrameSetHeightForView:(UIView *)view withPriority:(UILayoutPriority)priority; 28 | + (void)layoutTransformFrameSetGreaterOrEqualThan:(CGFloat)value forAttribute:(NSLayoutAttribute)attribute view:(UIView *)view; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Modality/Helpers/MODViewHelper.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODViewHelper.m 3 | // Modality 4 | // 5 | // Created by Kevin on 15/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODViewHelper.h" 10 | 11 | @implementation MODViewHelper 12 | 13 | #pragma mark - Public methods 14 | 15 | + (UIImageView *)snapshotCopyOfView:(UIView *)view { 16 | 17 | UIImage *imageSnapshot = [self imageSnapshotForView:view]; 18 | 19 | UIImageView *snapshotView = [[UIImageView alloc] initWithFrame:view.frame]; 20 | snapshotView.image = imageSnapshot; 21 | snapshotView.contentMode = UIViewContentModeScaleToFill; 22 | 23 | return snapshotView; 24 | } 25 | 26 | + (UIView *)onePixelLineStretchedSnapshotOfView:(UIView *)view withDirection:(MODDirection)direction { 27 | 28 | UIImage *snapshot = [self imageSnapshotForView:view]; 29 | CGFloat scale = snapshot.scale; 30 | 31 | CGRect cropRect = CGRectZero; 32 | switch (direction) { 33 | case MODDirectionTop: 34 | cropRect = CGRectMake(0, 0, view.frame.size.width*scale, scale); 35 | break; 36 | case MODDirectionBottom: 37 | cropRect = CGRectMake(0, view.frame.size.height*scale - scale, view.frame.size.width*scale, scale); 38 | break; 39 | case MODDirectionLeft: 40 | cropRect = CGRectMake(0, 0, scale, view.frame.size.height*scale); 41 | break; 42 | case MODDirectionRight: 43 | cropRect = CGRectMake(view.frame.size.width*scale - scale, 0, scale, view.frame.size.height*scale); 44 | break; 45 | 46 | default: 47 | break; 48 | } 49 | 50 | CGImageRef croppedImage = CGImageCreateWithImageInRect(snapshot.CGImage, cropRect); 51 | UIImage *oneLineImage = [UIImage imageWithCGImage:croppedImage scale:scale orientation:snapshot.imageOrientation]; 52 | CGImageRelease(croppedImage); 53 | 54 | UIImageView *stretchedSnapshotView = [[UIImageView alloc] initWithFrame:view.frame]; 55 | stretchedSnapshotView.image = oneLineImage; 56 | stretchedSnapshotView.contentMode = UIViewContentModeScaleToFill; 57 | 58 | return stretchedSnapshotView; 59 | } 60 | 61 | + (UIView *)viewWithBackgroundOfPixelAtPosition:(CGPoint)position inView:(UIView *)view { 62 | 63 | UIImage *snapshot = [self imageSnapshotForView:view]; 64 | const UInt8 * pixelData = CFDataGetBytePtr(CGDataProviderCopyData(CGImageGetDataProvider(snapshot.CGImage))); 65 | int pixelPosition = (snapshot.size.width * position.y + position.x) * 4; 66 | 67 | UIView *colorView = [[UIView alloc] initWithFrame:view.frame]; 68 | view.backgroundColor = [UIColor colorWithRed:pixelData[pixelPosition]/255.0 green:pixelData[pixelPosition + 1]/255.0 blue:pixelData[pixelPosition + 2]/255.0 alpha:pixelData[pixelPosition + 3]/255.0]; 69 | 70 | CFRelease(pixelData); 71 | return colorView; 72 | } 73 | 74 | + (void)layoutView:(UIView *)view withFrame:(CGRect)frame inOptionalContainer:(UIView *)containerView { 75 | 76 | [self removeSizeConstraintsOfView:view]; 77 | 78 | if (containerView) { 79 | [NSLayoutConstraint deactivateConstraints:containerView.constraints]; 80 | } 81 | 82 | [self horizontalLayoutView:view withFrame:frame]; 83 | [self verticalLayoutView:view withFrame:frame]; 84 | } 85 | 86 | + (void)layoutDockIntoSuperviewForView:(UIView *)view { 87 | 88 | view.translatesAutoresizingMaskIntoConstraints = NO; 89 | [self removeSizeConstraintsOfView:view]; 90 | [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(view)]]; 91 | [NSLayoutConstraint activateConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(view)]]; 92 | } 93 | 94 | + (void)layoutTransformFrameSetHorizontalForView:(UIView *)view { 95 | 96 | [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(view)]]; 97 | } 98 | 99 | + (void)layoutTransformFrameSetVerticalForView:(UIView *)view { 100 | 101 | [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(view)]]; 102 | } 103 | 104 | + (NSLayoutConstraint *)layoutTransformFrameSetEqualAttribute:(NSLayoutAttribute)attribute forView:(UIView *)view constant:(CGFloat)constant { 105 | 106 | NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view attribute:attribute relatedBy:NSLayoutRelationEqual toItem:view.superview attribute:attribute multiplier:1 constant:constant]; 107 | constraint.active = YES; 108 | 109 | return constraint; 110 | } 111 | 112 | + (void)layoutTransformFrameSetWidthForView:(UIView *)view withPriority:(UILayoutPriority)priority { 113 | 114 | NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:1 constant:view.bounds.size.width]; 115 | constraint.priority = priority; 116 | constraint.active = YES; 117 | } 118 | 119 | + (void)layoutTransformFrameSetHeightForView:(UIView *)view withPriority:(UILayoutPriority)priority { 120 | 121 | NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:0 multiplier:1 constant:view.bounds.size.height]; 122 | constraint.priority = priority; 123 | constraint.active = YES; 124 | } 125 | 126 | + (void)layoutTransformFrameSetGreaterOrEqualThan:(CGFloat)value forAttribute:(NSLayoutAttribute)attribute view:(UIView *)view { 127 | 128 | NSLayoutRelation relation = NSLayoutRelationGreaterThanOrEqual; 129 | if (attribute == NSLayoutAttributeRight || attribute == NSLayoutAttributeBottom) { 130 | relation = NSLayoutRelationLessThanOrEqual; 131 | value *= -1; 132 | } 133 | [NSLayoutConstraint constraintWithItem:view attribute:attribute relatedBy:relation toItem:view.superview attribute:attribute multiplier:1 constant:value].active = YES; 134 | } 135 | 136 | #pragma mark - Private methods 137 | 138 | + (UIImage *)imageSnapshotForView:(UIView *)view { 139 | 140 | UIGraphicsBeginImageContextWithOptions(view.frame.size, view.opaque, 0.0); 141 | CGContextRef context = UIGraphicsGetCurrentContext(); 142 | 143 | [view.layer renderInContext:context]; 144 | UIImage *snapshotImage = UIGraphicsGetImageFromCurrentImageContext(); 145 | 146 | UIGraphicsEndImageContext(); 147 | 148 | return snapshotImage; 149 | } 150 | 151 | + (void)horizontalLayoutView:(UIView *)view withFrame:(CGRect)frame { 152 | 153 | [NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-l-[view(==w)]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:@{ 154 | @"l":@(frame.origin.x), 155 | @"w":@(frame.size.width) 156 | }views:NSDictionaryOfVariableBindings(view)]]; 157 | } 158 | 159 | + (void)verticalLayoutView:(UIView *)view withFrame:(CGRect)frame { 160 | 161 | [NSLayoutConstraint activateConstraints: [NSLayoutConstraint constraintsWithVisualFormat:@"V:|-t-[view(==h)]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:@{ 162 | @"t":@(frame.origin.y), 163 | @"h":@(frame.size.height) 164 | }views:NSDictionaryOfVariableBindings(view)]]; 165 | } 166 | 167 | + (void)removeSizeConstraintsOfView:(UIView *)view { 168 | 169 | for (NSLayoutConstraint *constraint in view.constraints) { 170 | 171 | if (constraint.firstItem == view && 172 | (constraint.firstAttribute == NSLayoutAttributeHeight 173 | || constraint.firstAttribute == NSLayoutAttributeWidth)) { 174 | 175 | constraint.active = NO; 176 | } 177 | } 178 | } 179 | 180 | @end 181 | -------------------------------------------------------------------------------- /Modality/Protocols/MODTransitionAnimator.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitioningDelegate.h 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODDirection.h" 11 | #import "MODTransitionType.h" 12 | 13 | /** 14 | * Main protocol for transition animators 15 | */ 16 | @protocol MODTransitionAnimator 17 | 18 | @required 19 | 20 | /** 21 | * The duration of the transition 22 | */ 23 | @property (nonatomic, assign) CGFloat transitionDuration; 24 | 25 | /** 26 | * The type of transition 27 | */ 28 | @property (nonatomic, assign) MODTransitionType transitionType; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Modality/Transitioning/Base/MODDirectionalTransitioningBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODDirectionalTransitioningBase.h 3 | // Modality 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitioningBase.h" 10 | 11 | /** 12 | * Base transition animator for transitions that use 13 | * direction. 14 | * This is an abstract class and must not be instantiated. 15 | */ 16 | @interface MODDirectionalTransitioningBase : MODTransitioningBase 17 | 18 | /** 19 | * The direction of the transition 20 | */ 21 | @property (nonatomic, assign) MODDirection direction; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Modality/Transitioning/Base/MODDirectionalTransitioningBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODDirectionalTransitioningBase.m 3 | // Modality 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODDirectionalTransitioningBase.h" 10 | 11 | @implementation MODDirectionalTransitioningBase 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Modality/Transitioning/Base/MODModalTransitioningBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODModalTransitioningBase.h 3 | // Modality 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODDirectionalTransitioningBase.h" 11 | 12 | /** 13 | * Base transition animator class for modal transitions. 14 | * Performs common modal transition operations. 15 | * This class by itself won't present the destination view, 16 | * so instantiating this directly should be avoided. 17 | */ 18 | @interface MODModalTransitioningBase : MODDirectionalTransitioningBase 19 | 20 | /** 21 | * The length for the destination view that will be used 22 | * for displaying it as a modal view. The length is applied 23 | * depending on the specified direction. 24 | */ 25 | @property (nonatomic, assign) CGFloat destinationViewLength; 26 | 27 | /** 28 | * Factory method that returns an instance of the transition 29 | * animator configured with the specified parameters. 30 | * 31 | * @param direction The direction for the modal 32 | * presentation 33 | * @param destinationViewLength The length for the destination 34 | * view 35 | * 36 | * @return A set up transition animator 37 | */ 38 | + (instancetype)transitionAnimatorWithDirection:(MODDirection)direction 39 | destinationViewLength:(CGFloat)destinationViewLength; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /Modality/Transitioning/Base/MODModalTransitioningBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODModalTransitioningBase.m 3 | // Modality 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODModalTransitioningBase.h" 10 | #import "MODModalHelper.h" 11 | 12 | @interface MODModalTransitioningBase () 13 | 14 | @end 15 | 16 | @implementation MODModalTransitioningBase 17 | 18 | #pragma mark - Factory methods 19 | 20 | + (instancetype)transitionAnimatorWithDirection:(MODDirection)direction 21 | destinationViewLength:(CGFloat)destinationViewLength { 22 | 23 | MODModalTransitioningBase *modalTransitioningBase = [[self class] new]; 24 | modalTransitioningBase.direction = direction; 25 | modalTransitioningBase.destinationViewLength = destinationViewLength; 26 | 27 | return modalTransitioningBase; 28 | } 29 | 30 | #pragma mark - Accessors 31 | 32 | - (MODTransitionType)transitionType { 33 | 34 | return MODTransitionTypeModal; 35 | } 36 | 37 | #pragma mark - UIViewControllerAnimatedTransitioning 38 | 39 | - (void)animateTransition:(id)transitionContext { 40 | 41 | UIView *container = [transitionContext containerView]; 42 | 43 | if (self.isPresenting) { 44 | 45 | UIViewController *destinationViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; 46 | [MODModalHelper addModalBackgroundAnimationToView:container withDuration:self.transitionDuration alpha:0.3f destinationViewController:destinationViewController]; 47 | } 48 | else { 49 | 50 | [MODModalHelper removeModalBackgroundAnimationFromView:container withDuration:self.transitionDuration]; 51 | } 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /Modality/Transitioning/Base/MODTransitioningBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitioningBaseDelegate.h 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODTransitionAnimator.h" 11 | #import "MODDefaults.h" 12 | #import "UIViewController+Modality.h" 13 | 14 | /** 15 | * Base transition animator that performs common tasks. 16 | * This is an abstract class and must not be instantiated. 17 | */ 18 | @interface MODTransitioningBase : NSObject 19 | 20 | /** 21 | * The duration of the transition 22 | */ 23 | @property (nonatomic, assign) CGFloat transitionDuration; 24 | 25 | /** 26 | * Indicates if the current transition is for presenting. 27 | */ 28 | @property (nonatomic, assign, readonly) BOOL isPresenting; 29 | 30 | /** 31 | * The transition type 32 | */ 33 | @property (nonatomic, assign) MODTransitionType transitionType; 34 | 35 | /** 36 | * Indicates if the transition is a navigation controller 37 | * transition. 38 | */ 39 | @property (nonatomic, assign) BOOL isNavigationAnimation; 40 | 41 | /** 42 | * Returns the default duration that the animation will 43 | * take if transitionDuration is set to 44 | * MODDefaultTransitionDuration 45 | * 46 | * @return The default transition duration 47 | */ 48 | - (CGFloat)defaultTransitionDuration; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /Modality/Transitioning/Base/MODTransitioningBase.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitioningBaseDelegate.m 3 | // Modality 4 | // 5 | // Created by Kevin on 12/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitioningBase.h" 10 | #import "MODDefaults.h" 11 | 12 | @interface MODTransitioningBase () 13 | 14 | @property (nonatomic, assign) BOOL isPresenting; 15 | 16 | @end 17 | 18 | @implementation MODTransitioningBase 19 | 20 | - (instancetype)init { 21 | 22 | if (self = [super init]) { 23 | 24 | self.transitionDuration = MODDefaulTransitionDuration; 25 | self.transitionType = MODTransitionTypeFullScreen; 26 | } 27 | 28 | return self; 29 | } 30 | 31 | #pragma mark - Accessors 32 | 33 | - (void)setTransitionDuration:(CGFloat)transitionDuration { 34 | 35 | if (transitionDuration == MODDefaulTransitionDuration) { 36 | _transitionDuration = [self defaultTransitionDuration]; 37 | } 38 | else { 39 | _transitionDuration = transitionDuration; 40 | } 41 | } 42 | 43 | #pragma mark - Private methdos 44 | 45 | - (CGFloat)defaultTransitionDuration { 46 | 47 | return 0.5; 48 | } 49 | 50 | #pragma mark - UIViewControllerAnimatedTransitioning 51 | 52 | - (void)animateTransition:(id)transitionContext { 53 | 54 | [NSException raise:@"Illegal execution exception" format:@"%@", @"This method should not be executed in this class. Override it in its subclasses."]; 55 | } 56 | 57 | - (CGFloat)transitionDuration:(id)transitionContext { 58 | 59 | return self.transitionDuration; 60 | } 61 | 62 | #pragma mark - UIViewControllerTransitioningDelegate 63 | 64 | - (id)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source { 65 | 66 | self.isPresenting = YES; 67 | return self; 68 | } 69 | 70 | - (id)animationControllerForDismissedController:(UIViewController *)dismissed { 71 | 72 | self.isPresenting = NO; 73 | return self; 74 | } 75 | 76 | #pragma mark - UINavigationControllerDelegate 77 | 78 | - (id) navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC { 79 | 80 | self.isNavigationAnimation = YES; 81 | 82 | if (operation == UINavigationControllerOperationPush) { 83 | self.isPresenting = YES; 84 | } 85 | else { 86 | self.isPresenting = NO; 87 | } 88 | return self; 89 | } 90 | 91 | @end 92 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorCarryOver.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorCarryOver.h 3 | // Modality 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitioningBase.h" 10 | #import 11 | 12 | /** 13 | * Protocol that provides information about the destination 14 | * of the transition 15 | */ 16 | @protocol MODCarryOverDestinationDelegate; 17 | 18 | /** 19 | * Transition animator that carries over a specified view 20 | * in the initial view to a container in the destination 21 | * view. Layout constraints are restored after the view is 22 | * returned to it's original superview. 23 | */ 24 | @interface MODTransitionAnimatorCarryOver : MODTransitioningBase 25 | 26 | /** 27 | * Factory method for creating the animator. 28 | * 29 | * @param carryOverView The view to carry over 30 | * @param destinationDelegate The class that implements 31 | * MODCarryOverDestinationDelegate 32 | * 33 | * @return A set up transition animator 34 | */ 35 | + (instancetype)transitionAnimatorWithCarryOverView:(UIView *)carryOverView destinationDelegate:(UIViewController *)destinationDelegate; 36 | 37 | /** 38 | * The view to carry over 39 | */ 40 | @property (nonatomic, strong) UIView *carryOverView; 41 | 42 | /** 43 | * The class that implements MODCarryOverDestinationDelegate 44 | */ 45 | @property (nonatomic, weak) UIViewController *destinationDelegate; 46 | 47 | @end 48 | 49 | @protocol MODCarryOverDestinationDelegate 50 | 51 | @required 52 | 53 | /** 54 | * Specifies a destination container for the view to 55 | * carry over. 56 | * 57 | * @return The destination container. 58 | */ 59 | - (UIView *)destinationContainerForTransitionAnimator; 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorCarryOver.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorCarryOver.m 3 | // Modality 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitionAnimatorCarryOver.h" 10 | #import "MODDefaults.h" 11 | #import "MODViewHelper.h" 12 | 13 | @interface MODTransitionAnimatorCarryOver () 14 | 15 | @property (nonatomic, weak) UIView *carryOverViewSuperview; 16 | @property (nonatomic, strong) NSArray *carryOverViewSuperviewConstraints; 17 | @property (nonatomic, assign) NSInteger carryOverViewIndexAtSuperview; 18 | @property (nonatomic, strong) NSArray *carryOverViewConstraints; 19 | @property (nonatomic, assign) CGRect carryOverViewFrame; 20 | 21 | @end 22 | 23 | @implementation MODTransitionAnimatorCarryOver 24 | 25 | #pragma mark - Factory methods 26 | 27 | + (instancetype)transitionAnimatorWithCarryOverView:(UIView *)carryOverView destinationDelegate:(UIViewController *)destinationDelegate { 28 | 29 | MODTransitionAnimatorCarryOver *transitionAnimator = [self new]; 30 | transitionAnimator.carryOverView = carryOverView; 31 | transitionAnimator.destinationDelegate = destinationDelegate; 32 | 33 | return transitionAnimator; 34 | } 35 | 36 | #pragma mark - UIViewControllerAnimatedTransitioning 37 | 38 | - (void)animateTransition:(id)transitionContext { 39 | 40 | NSAssert(self.carryOverView != nil, @"Carry over view cannot be nil"); 41 | NSAssert(self.destinationDelegate != nil, @"Destination delegate cannot be nil"); 42 | 43 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 44 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 45 | UIView *container = [transitionContext containerView]; 46 | 47 | if (self.isPresenting) { 48 | 49 | [container addSubview:fromView]; 50 | [container addSubview:toView]; 51 | 52 | UIView *destinationContainer = [self.destinationDelegate destinationContainerForTransitionAnimator]; 53 | if (destinationContainer.superview) { 54 | [destinationContainer.superview layoutIfNeeded]; 55 | } 56 | else { 57 | [destinationContainer layoutIfNeeded]; 58 | } 59 | 60 | self.carryOverView.translatesAutoresizingMaskIntoConstraints = NO; 61 | CGRect fromFrame = [self.carryOverView.superview convertRect:self.carryOverView.frame toView:container]; 62 | CGRect toFrame = [toView convertRect:destinationContainer.frame fromView:container]; 63 | self.carryOverViewSuperview = self.carryOverView.superview; 64 | self.carryOverViewSuperviewConstraints = self.carryOverViewSuperview.constraints; 65 | self.carryOverViewFrame = fromFrame; 66 | self.carryOverViewConstraints = self.carryOverView.constraints; 67 | self.carryOverViewIndexAtSuperview = [self.carryOverViewSuperview.subviews indexOfObject:self.carryOverView]; 68 | toView.alpha = 0; 69 | 70 | [self.carryOverView removeFromSuperview]; 71 | [container addSubview:self.carryOverView]; 72 | [MODViewHelper layoutView:self.carryOverView withFrame:fromFrame inOptionalContainer:container]; 73 | [container layoutIfNeeded]; 74 | 75 | [MODViewHelper layoutView:self.carryOverView withFrame:toFrame inOptionalContainer:container]; 76 | [UIView animateWithDuration:self.transitionDuration delay:0 usingSpringWithDamping:0.7f initialSpringVelocity:1 options:0 animations:^{ 77 | 78 | [container layoutIfNeeded]; 79 | toView.alpha = 1; 80 | 81 | } completion:^(BOOL finished) { 82 | 83 | [transitionContext completeTransition:YES]; 84 | 85 | [self.carryOverView removeFromSuperview]; 86 | [destinationContainer addSubview:self.carryOverView]; 87 | [MODViewHelper layoutDockIntoSuperviewForView:self.carryOverView]; 88 | [destinationContainer layoutIfNeeded]; 89 | }]; 90 | } 91 | else { 92 | 93 | [container addSubview:toView]; 94 | [container addSubview:fromView]; 95 | 96 | [self layoutCarryOverViewBackToSuperview]; 97 | CGRect toFrame = [self.carryOverViewSuperview convertRect:self.carryOverView.frame toView:container]; 98 | UIView *destinationContainer = [self.destinationDelegate destinationContainerForTransitionAnimator]; 99 | CGRect fromFrame = [fromView convertRect:destinationContainer.frame toView:container]; 100 | 101 | [self.carryOverView removeFromSuperview]; 102 | [container addSubview:self.carryOverView]; 103 | [MODViewHelper layoutView:self.carryOverView withFrame:fromFrame inOptionalContainer:container]; 104 | [container layoutIfNeeded]; 105 | 106 | [MODViewHelper layoutView:self.carryOverView withFrame:toFrame inOptionalContainer:container]; 107 | [UIView animateWithDuration:self.transitionDuration delay:0 usingSpringWithDamping:1 initialSpringVelocity:1 options:0 animations:^{ 108 | 109 | [container layoutIfNeeded]; 110 | fromView.alpha = 0; 111 | 112 | } completion:^(BOOL finished) { 113 | 114 | [transitionContext completeTransition:YES]; 115 | [self layoutCarryOverViewBackToSuperview]; 116 | }]; 117 | } 118 | } 119 | 120 | - (void)layoutCarryOverViewBackToSuperview { 121 | 122 | [self.carryOverView removeFromSuperview]; 123 | [self.carryOverViewSuperview insertSubview:self.carryOverView atIndex:self.carryOverViewIndexAtSuperview]; 124 | [NSLayoutConstraint deactivateConstraints:self.carryOverView.constraints]; 125 | if (self.carryOverViewConstraints) 126 | [NSLayoutConstraint activateConstraints:self.carryOverViewConstraints]; 127 | if (self.carryOverViewSuperviewConstraints) { 128 | [NSLayoutConstraint deactivateConstraints:self.carryOverViewSuperview.constraints]; 129 | [NSLayoutConstraint activateConstraints:self.carryOverViewSuperviewConstraints]; 130 | } 131 | [self.carryOverViewSuperview layoutIfNeeded]; 132 | } 133 | 134 | @end 135 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorFade.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorFade.h 3 | // Modality 4 | // 5 | // Created by Kevin on 28/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitioningBase.h" 10 | 11 | /** 12 | * Transition animator that fades in the destination 13 | * view. 14 | */ 15 | @interface MODTransitionAnimatorFade : MODTransitioningBase 16 | 17 | /** 18 | * Creates a transition animator. 19 | * 20 | * @return The created transition animator 21 | */ 22 | + (instancetype)transitionAnimatior; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorFade.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorFade.m 3 | // Modality 4 | // 5 | // Created by Kevin on 28/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitionAnimatorFade.h" 10 | #import "MODDefaults.h" 11 | #import "MODViewHelper.h" 12 | 13 | @implementation MODTransitionAnimatorFade 14 | 15 | + (instancetype)transitionAnimatior { 16 | 17 | return [self new]; 18 | } 19 | 20 | #pragma mark - UIViewControllerAnimatedTransitioning 21 | 22 | - (void)animateTransition:(id)transitionContext { 23 | 24 | UIView *container = [transitionContext containerView]; 25 | 26 | if (self.isPresenting) { 27 | 28 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 29 | if (self.isNavigationAnimation) { 30 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 31 | [container addSubview:[MODViewHelper snapshotCopyOfView:fromView]]; 32 | } 33 | 34 | [container addSubview:toView]; 35 | 36 | toView.alpha = 0; 37 | [UIView animateWithDuration:self.transitionDuration animations:^{ 38 | 39 | toView.alpha = 1; 40 | 41 | } completion:^(BOOL finished) { 42 | 43 | if (finished) { 44 | [transitionContext completeTransition:YES]; 45 | } 46 | }]; 47 | } 48 | else { 49 | 50 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 51 | if (self.isNavigationAnimation) { 52 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 53 | [container addSubview:toView]; 54 | } 55 | [container addSubview:fromView]; 56 | 57 | [UIView animateWithDuration:self.transitionDuration animations:^{ 58 | 59 | fromView.alpha = 0; 60 | 61 | } completion:^(BOOL finished) { 62 | 63 | if (finished) { 64 | [transitionContext completeTransition:YES]; 65 | } 66 | }]; 67 | } 68 | } 69 | 70 | - (MODTransitionType)transitionType { 71 | return MODTransitionTypeModal; 72 | } 73 | 74 | @end 75 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorFlipModal.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorFlipModal.h 3 | // Modality 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODModalTransitioningBase.h" 10 | 11 | /** 12 | * Modal transition animator that flips the destination view. 13 | */ 14 | @interface MODTransitionAnimatorFlipModal : MODModalTransitioningBase 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorFlipModal.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorFlipModal.m 3 | // Modality 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitionAnimatorFlipModal.h" 10 | #import "MODModalHelper.h" 11 | 12 | @implementation MODTransitionAnimatorFlipModal 13 | 14 | - (void)animateTransition:(id)transitionContext { 15 | 16 | [super animateTransition:transitionContext]; 17 | 18 | UIView *container = [transitionContext containerView]; 19 | 20 | BOOL horizontal = self.direction == MODDirectionLeft || self.direction == MODDirectionRight; 21 | 22 | if (self.isPresenting) { 23 | 24 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 25 | [toView layoutIfNeeded]; 26 | [container addSubview:toView]; 27 | 28 | [MODModalHelper setupFrameForView:toView inContainerView:container withLength:self.destinationViewLength andDirection:self.direction offset:0]; 29 | 30 | [self flipView:toView horizontal:horizontal]; 31 | toView.alpha = 0; 32 | 33 | [UIView animateWithDuration:self.transitionDuration delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 34 | 35 | [self flipToIdentity:toView]; 36 | toView.alpha = 1; 37 | } completion:^(BOOL finished) { 38 | [transitionContext completeTransition:YES]; 39 | }]; 40 | } 41 | else { 42 | 43 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 44 | [container addSubview:fromView]; 45 | 46 | [UIView animateWithDuration:self.transitionDuration delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 47 | fromView.alpha = 0; 48 | [self flipView:fromView horizontal:horizontal]; 49 | } completion:^(BOOL finished) { 50 | [fromView removeFromSuperview]; 51 | [transitionContext completeTransition:YES]; 52 | }]; 53 | } 54 | } 55 | 56 | - (void)flipView:(UIView *)view horizontal:(BOOL)horizontal { 57 | 58 | CATransform3D transformLayer = CATransform3DIdentity; 59 | transformLayer.m34 = -0.0001; 60 | transformLayer = CATransform3DTranslate(transformLayer, 0, 0, 5000); 61 | transformLayer = CATransform3DRotate(transformLayer, 150 / 180.0 * M_PI, 1 * !horizontal, 1 * horizontal, 0); 62 | 63 | view.layer.transform = transformLayer; 64 | } 65 | 66 | - (void)flipToIdentity:(UIView *)view { 67 | 68 | CATransform3D transformLayer = CATransform3DIdentity; 69 | transformLayer = CATransform3DTranslate(transformLayer, 0, 0, 5000); 70 | view.layer.transform = transformLayer; 71 | } 72 | 73 | - (CGFloat)defaultTransitionDuration { 74 | 75 | return 0.35; 76 | } 77 | 78 | @end 79 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorMask.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorMask.h 3 | // Modality 4 | // 5 | // Created by Kevin on 30/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitioningBase.h" 10 | 11 | /** 12 | * Transition animator that masks the destination view 13 | * with the specified image, and animates the mask to a 14 | * bigger size. 15 | */ 16 | @interface MODTransitionAnimatorMask : MODTransitioningBase 17 | 18 | /** 19 | * Factory method to create the transition animator with 20 | * the specified mask image. 21 | * 22 | * @param maskImage The image to mask the destination view 23 | * 24 | * @return The set up transition animator 25 | */ 26 | + (MODTransitionAnimatorMask *)transitionAnimatorWithMaskImage:(UIImage *)maskImage; 27 | 28 | /** 29 | * The image to mask the destination view 30 | */ 31 | @property (nonatomic, strong) UIImage *maskImage; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorMask.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorMask.m 3 | // Modality 4 | // 5 | // Created by Kevin on 30/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitionAnimatorMask.h" 10 | 11 | static CGFloat const kMaskSizeSmall = 30; 12 | 13 | @implementation MODTransitionAnimatorMask 14 | 15 | + (MODTransitionAnimatorMask *)transitionAnimatorWithMaskImage:(UIImage *)maskImage { 16 | 17 | MODTransitionAnimatorMask *transitionAnimator = [MODTransitionAnimatorMask new]; 18 | transitionAnimator.maskImage = maskImage; 19 | 20 | return transitionAnimator; 21 | } 22 | 23 | - (void)animateTransition:(id)transitionContext { 24 | 25 | UIView *containerView = [transitionContext containerView]; 26 | 27 | CGFloat animationDuration = self.transitionDuration; 28 | 29 | CGSize smallSize = CGSizeMake(kMaskSizeSmall, kMaskSizeSmall); 30 | CGFloat maskFullSize = MAX(containerView.frame.size.height, containerView.frame.size.width); 31 | if (maskFullSize > 1000) { 32 | maskFullSize += 500; 33 | } 34 | CGSize bigSize = CGSizeMake(maskFullSize * 3, maskFullSize * 3); 35 | 36 | if (self.isPresenting) { 37 | 38 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 39 | [containerView addSubview:toView]; 40 | 41 | [self animateView:toView withMaskAnimationWithImage:self.maskImage duration:animationDuration initialMaskSize:smallSize finalMaskSize:bigSize andCompletionBlock:nil]; 42 | 43 | CGAffineTransform toTransform = toView.transform; 44 | toView.transform = CGAffineTransformMakeScale(1.07f, 1.07f); 45 | 46 | [UIView animateWithDuration:animationDuration + 0.1f delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ 47 | toView.transform = toTransform; 48 | } completion:^(BOOL finished) { 49 | [transitionContext completeTransition:YES]; 50 | }]; 51 | } 52 | else { 53 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 54 | [containerView addSubview:fromView]; 55 | 56 | [self animateView:fromView withMaskAnimationWithImage:self.maskImage duration:animationDuration initialMaskSize:bigSize finalMaskSize:smallSize andCompletionBlock:^{ 57 | [transitionContext completeTransition:YES]; 58 | [fromView removeFromSuperview]; 59 | }]; 60 | 61 | CGFloat delay = 0.1f; 62 | [UIView animateWithDuration:animationDuration - delay delay:delay options:UIViewAnimationOptionCurveEaseIn animations:^{ 63 | fromView.alpha = 0.f; 64 | } completion:nil]; 65 | } 66 | } 67 | 68 | - (void)animateView:(UIView *)view withMaskAnimationWithImage:(UIImage *)image duration:(CGFloat)duration initialMaskSize:(CGSize)initialMaskSize finalMaskSize:(CGSize)finalMaskSize andCompletionBlock:(void(^)())completionBlock { 69 | 70 | CALayer *mask = [CALayer new]; 71 | mask.contents = (__bridge id)(image.CGImage); 72 | mask.anchorPoint = CGPointMake(0.5f, 0.5f); 73 | mask.position = CGPointMake(view.frame.size.width / 2, view.frame.size.height / 2); 74 | 75 | mask.bounds = CGRectMake(0, 0, finalMaskSize.width, finalMaskSize.height); 76 | NSValue *toValue = [NSValue valueWithCGRect: mask.bounds]; 77 | NSValue *fromValue = [NSValue valueWithCGRect: CGRectMake(0, 0, initialMaskSize.width, initialMaskSize.height)]; 78 | view.layer.mask = mask; 79 | 80 | [CATransaction begin]; 81 | [CATransaction setCompletionBlock:^{ 82 | 83 | view.layer.mask = nil; 84 | if (completionBlock) 85 | completionBlock (); 86 | }]; 87 | 88 | CABasicAnimation *maskAnimation = [CABasicAnimation animationWithKeyPath:@"bounds"]; 89 | 90 | maskAnimation.fromValue = fromValue; 91 | maskAnimation.toValue = toValue; 92 | maskAnimation.duration = duration; 93 | maskAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 94 | 95 | [mask addAnimation:maskAnimation forKey:@"bounds"]; 96 | 97 | [CATransaction commit]; 98 | } 99 | 100 | - (MODTransitionType)transitionType { 101 | return MODTransitionTypeModal; 102 | } 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorSlideModal.h: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorSlideModal.h 3 | // Modality 4 | // 5 | // Created by Kevin on 11/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODModalTransitioningBase.h" 11 | 12 | /** 13 | * Modal transition animator with a slide animation. 14 | */ 15 | @interface MODTransitionAnimatorSlideModal : MODModalTransitioningBase 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Modality/Transitioning/TransitionAnimators/MODTransitionAnimatorSlideModal.m: -------------------------------------------------------------------------------- 1 | // 2 | // MODTransitionAnimatorSlideModal.m 3 | // Modality 4 | // 5 | // Created by Kevin on 11/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "MODTransitionAnimatorSlideModal.h" 10 | #import "MODTransformFactory.h" 11 | #import "MODModalHelper.h" 12 | #import "MODPropertiesHelper.h" 13 | #import "MODViewHelper.h" 14 | #import "MODDefaults.h" 15 | 16 | @interface MODTransitionAnimatorSlideModal () 17 | 18 | @property (nonatomic, strong) NSLayoutConstraint *animationConstraint; 19 | @property (nonatomic, assign) CGFloat initialAnimationConstant; 20 | 21 | @end 22 | 23 | @implementation MODTransitionAnimatorSlideModal 24 | 25 | #pragma mark - UIViewControllerAnimatedTransitioning 26 | 27 | - (void)animateTransition:(id)transitionContext { 28 | 29 | [super animateTransition:transitionContext]; 30 | 31 | UIView *container = [transitionContext containerView]; 32 | 33 | if (self.isPresenting) { 34 | 35 | UIView *toView = [transitionContext viewForKey:UITransitionContextToViewKey]; 36 | [toView layoutIfNeeded]; 37 | [container addSubview:toView]; 38 | 39 | self.animationConstraint = [MODModalHelper setupFrameForView:toView inContainerView:container withLength:self.destinationViewLength andDirection:self.direction offset:1]; 40 | self.initialAnimationConstant = self.animationConstraint.constant; 41 | [container layoutIfNeeded]; 42 | 43 | UIView *snapshotView = [MODViewHelper onePixelLineStretchedSnapshotOfView:toView withDirection:self.direction]; 44 | [container insertSubview:snapshotView belowSubview:toView]; 45 | NSLayoutConstraint *snapshotAnimationConstraint = [MODModalHelper setupFrameForView:snapshotView inContainerView:container withLength:self.destinationViewLength andDirection:self.direction offset:2]; 46 | [container layoutIfNeeded]; 47 | 48 | CGFloat constraintDifference = snapshotAnimationConstraint.constant - self.animationConstraint.constant; 49 | self.animationConstraint.constant = 0; 50 | snapshotAnimationConstraint.constant = constraintDifference; 51 | 52 | [UIView animateWithDuration:self.transitionDuration delay:0 usingSpringWithDamping:0.7f initialSpringVelocity:1 options:0 animations:^{ 53 | 54 | [container layoutIfNeeded]; 55 | 56 | } completion:^(BOOL finished) { 57 | if (finished) { 58 | [transitionContext completeTransition:YES]; 59 | [snapshotView removeFromSuperview]; 60 | } 61 | }]; 62 | } 63 | else { 64 | 65 | UIView *fromView = [transitionContext viewForKey:UITransitionContextFromViewKey]; 66 | [container addSubview:fromView]; 67 | 68 | self.animationConstraint.constant = self.initialAnimationConstant; 69 | 70 | [UIView animateWithDuration:self.transitionDuration animations:^{ 71 | [container layoutIfNeeded]; 72 | } completion:^(BOOL finished) { 73 | if (finished) { 74 | [transitionContext completeTransition:YES]; 75 | [fromView removeFromSuperview]; 76 | } 77 | }]; 78 | } 79 | } 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0B0069A21A1E4F7200A2DC35 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069A11A1E4F7200A2DC35 /* main.m */; }; 11 | 0B0069AB1A1E4F7200A2DC35 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0B0069A91A1E4F7200A2DC35 /* Main.storyboard */; }; 12 | 0B0069AD1A1E4F7200A2DC35 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0B0069AC1A1E4F7200A2DC35 /* Images.xcassets */; }; 13 | 0B0069B01A1E4F7200A2DC35 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0B0069AE1A1E4F7200A2DC35 /* LaunchScreen.xib */; }; 14 | 0B0069BC1A1E4F7200A2DC35 /* ModalityExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069BB1A1E4F7200A2DC35 /* ModalityExampleTests.m */; }; 15 | 0B0069E61A1E504000A2DC35 /* UIViewController+Modality.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069C81A1E504000A2DC35 /* UIViewController+Modality.m */; }; 16 | 0B0069E71A1E504000A2DC35 /* MODTransformFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069D21A1E504000A2DC35 /* MODTransformFactory.m */; }; 17 | 0B0069E81A1E504000A2DC35 /* MODModalHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069D51A1E504000A2DC35 /* MODModalHelper.m */; }; 18 | 0B0069E91A1E504000A2DC35 /* MODPropertiesHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069D71A1E504000A2DC35 /* MODPropertiesHelper.m */; }; 19 | 0B0069EC1A1E504000A2DC35 /* MODViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069DD1A1E504000A2DC35 /* MODViewHelper.m */; }; 20 | 0B0069F51A1E6DFC00A2DC35 /* MODTransitioningBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069F41A1E6DFC00A2DC35 /* MODTransitioningBase.m */; }; 21 | 0B0069F81A1E6E4900A2DC35 /* MODModalTransitioningBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069F71A1E6E4900A2DC35 /* MODModalTransitioningBase.m */; }; 22 | 0B0069FB1A1E6F8E00A2DC35 /* MODDirectionalTransitioningBase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069FA1A1E6F8E00A2DC35 /* MODDirectionalTransitioningBase.m */; }; 23 | 0B0069FF1A1E772A00A2DC35 /* MODTransitionAnimatorSlideModal.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B0069FE1A1E772A00A2DC35 /* MODTransitionAnimatorSlideModal.m */; }; 24 | 0B006A021A1E78C000A2DC35 /* MODTransitionAnimatorCarryOver.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B006A011A1E78C000A2DC35 /* MODTransitionAnimatorCarryOver.m */; }; 25 | 0B7E6CBF1A2A91F40011B187 /* MODTransitionAnimatorMask.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B7E6CBE1A2A91F40011B187 /* MODTransitionAnimatorMask.m */; }; 26 | 0B95B7361A33C4770091D704 /* CarryOverViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B95B7351A33C4770091D704 /* CarryOverViewController.m */; }; 27 | 0B95B7391A33C6A50091D704 /* DirectionButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0B95B7381A33C6A50091D704 /* DirectionButton.m */; }; 28 | 0BCB1E921A27EBF300DB8843 /* MODTransitionAnimatorFade.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BCB1E911A27EBF300DB8843 /* MODTransitionAnimatorFade.m */; }; 29 | 0BFEF8CD1A333AB700848014 /* MODTransitionAnimatorFlipModal.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BFEF8CC1A333AB700848014 /* MODTransitionAnimatorFlipModal.m */; }; 30 | 0BFEF8D51A33669800848014 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BFEF8D01A33669800848014 /* AppDelegate.m */; }; 31 | 0BFEF8D91A3366BB00848014 /* DIrectionLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BFEF8D81A3366BB00848014 /* DIrectionLabel.m */; }; 32 | 0BFEF8DC1A33698C00848014 /* CellContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BFEF8DB1A33698C00848014 /* CellContentView.m */; }; 33 | 0BFEF8E31A33726700848014 /* TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BFEF8E21A33726700848014 /* TableViewController.m */; }; 34 | 0BFEF8E61A33BA4A00848014 /* FadeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 0BFEF8E51A33BA4A00848014 /* FadeViewController.m */; }; 35 | /* End PBXBuildFile section */ 36 | 37 | /* Begin PBXContainerItemProxy section */ 38 | 0B0069B61A1E4F7200A2DC35 /* PBXContainerItemProxy */ = { 39 | isa = PBXContainerItemProxy; 40 | containerPortal = 0B0069941A1E4F7200A2DC35 /* Project object */; 41 | proxyType = 1; 42 | remoteGlobalIDString = 0B00699B1A1E4F7200A2DC35; 43 | remoteInfo = ModalityExample; 44 | }; 45 | /* End PBXContainerItemProxy section */ 46 | 47 | /* Begin PBXFileReference section */ 48 | 0B00699C1A1E4F7200A2DC35 /* ModalityExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ModalityExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 0B0069A01A1E4F7200A2DC35 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 0B0069A11A1E4F7200A2DC35 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 51 | 0B0069AA1A1E4F7200A2DC35 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 52 | 0B0069AC1A1E4F7200A2DC35 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 53 | 0B0069AF1A1E4F7200A2DC35 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 54 | 0B0069B51A1E4F7200A2DC35 /* ModalityExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ModalityExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 55 | 0B0069BA1A1E4F7200A2DC35 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | 0B0069BB1A1E4F7200A2DC35 /* ModalityExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ModalityExampleTests.m; sourceTree = ""; }; 57 | 0B0069C71A1E504000A2DC35 /* UIViewController+Modality.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+Modality.h"; sourceTree = ""; }; 58 | 0B0069C81A1E504000A2DC35 /* UIViewController+Modality.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+Modality.m"; sourceTree = ""; }; 59 | 0B0069CA1A1E504000A2DC35 /* MODDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODDefaults.h; sourceTree = ""; }; 60 | 0B0069CB1A1E504000A2DC35 /* MODDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODDirection.h; sourceTree = ""; }; 61 | 0B0069CD1A1E504000A2DC35 /* MODTransitionType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransitionType.h; sourceTree = ""; }; 62 | 0B0069D11A1E504000A2DC35 /* MODTransformFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransformFactory.h; sourceTree = ""; }; 63 | 0B0069D21A1E504000A2DC35 /* MODTransformFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODTransformFactory.m; sourceTree = ""; }; 64 | 0B0069D41A1E504000A2DC35 /* MODModalHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODModalHelper.h; sourceTree = ""; }; 65 | 0B0069D51A1E504000A2DC35 /* MODModalHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODModalHelper.m; sourceTree = ""; }; 66 | 0B0069D61A1E504000A2DC35 /* MODPropertiesHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODPropertiesHelper.h; sourceTree = ""; }; 67 | 0B0069D71A1E504000A2DC35 /* MODPropertiesHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODPropertiesHelper.m; sourceTree = ""; }; 68 | 0B0069DC1A1E504000A2DC35 /* MODViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODViewHelper.h; sourceTree = ""; }; 69 | 0B0069DD1A1E504000A2DC35 /* MODViewHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODViewHelper.m; sourceTree = ""; }; 70 | 0B0069F11A1E6AC400A2DC35 /* MODTransitionAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransitionAnimator.h; sourceTree = ""; }; 71 | 0B0069F31A1E6DFC00A2DC35 /* MODTransitioningBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransitioningBase.h; sourceTree = ""; }; 72 | 0B0069F41A1E6DFC00A2DC35 /* MODTransitioningBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODTransitioningBase.m; sourceTree = ""; }; 73 | 0B0069F61A1E6E4900A2DC35 /* MODModalTransitioningBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODModalTransitioningBase.h; sourceTree = ""; }; 74 | 0B0069F71A1E6E4900A2DC35 /* MODModalTransitioningBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODModalTransitioningBase.m; sourceTree = ""; }; 75 | 0B0069F91A1E6F8E00A2DC35 /* MODDirectionalTransitioningBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODDirectionalTransitioningBase.h; sourceTree = ""; }; 76 | 0B0069FA1A1E6F8E00A2DC35 /* MODDirectionalTransitioningBase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODDirectionalTransitioningBase.m; sourceTree = ""; }; 77 | 0B0069FD1A1E772A00A2DC35 /* MODTransitionAnimatorSlideModal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransitionAnimatorSlideModal.h; sourceTree = ""; }; 78 | 0B0069FE1A1E772A00A2DC35 /* MODTransitionAnimatorSlideModal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODTransitionAnimatorSlideModal.m; sourceTree = ""; }; 79 | 0B006A001A1E78C000A2DC35 /* MODTransitionAnimatorCarryOver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransitionAnimatorCarryOver.h; sourceTree = ""; }; 80 | 0B006A011A1E78C000A2DC35 /* MODTransitionAnimatorCarryOver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODTransitionAnimatorCarryOver.m; sourceTree = ""; }; 81 | 0B7E6CBD1A2A91F40011B187 /* MODTransitionAnimatorMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransitionAnimatorMask.h; sourceTree = ""; }; 82 | 0B7E6CBE1A2A91F40011B187 /* MODTransitionAnimatorMask.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODTransitionAnimatorMask.m; sourceTree = ""; }; 83 | 0B95B7341A33C4770091D704 /* CarryOverViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CarryOverViewController.h; sourceTree = ""; }; 84 | 0B95B7351A33C4770091D704 /* CarryOverViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CarryOverViewController.m; sourceTree = ""; }; 85 | 0B95B7371A33C6A50091D704 /* DirectionButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectionButton.h; sourceTree = ""; }; 86 | 0B95B7381A33C6A50091D704 /* DirectionButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DirectionButton.m; sourceTree = ""; }; 87 | 0BCB1E901A27EBF300DB8843 /* MODTransitionAnimatorFade.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransitionAnimatorFade.h; sourceTree = ""; }; 88 | 0BCB1E911A27EBF300DB8843 /* MODTransitionAnimatorFade.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODTransitionAnimatorFade.m; sourceTree = ""; }; 89 | 0BFEF8CB1A333AB700848014 /* MODTransitionAnimatorFlipModal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MODTransitionAnimatorFlipModal.h; sourceTree = ""; }; 90 | 0BFEF8CC1A333AB700848014 /* MODTransitionAnimatorFlipModal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MODTransitionAnimatorFlipModal.m; sourceTree = ""; }; 91 | 0BFEF8CF1A33669800848014 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 92 | 0BFEF8D01A33669800848014 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 93 | 0BFEF8D71A3366BB00848014 /* DIrectionLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DIrectionLabel.h; sourceTree = ""; }; 94 | 0BFEF8D81A3366BB00848014 /* DIrectionLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DIrectionLabel.m; sourceTree = ""; }; 95 | 0BFEF8DA1A33698C00848014 /* CellContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CellContentView.h; sourceTree = ""; }; 96 | 0BFEF8DB1A33698C00848014 /* CellContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CellContentView.m; sourceTree = ""; }; 97 | 0BFEF8E11A33726700848014 /* TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableViewController.h; sourceTree = ""; }; 98 | 0BFEF8E21A33726700848014 /* TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableViewController.m; sourceTree = ""; }; 99 | 0BFEF8E41A33BA4A00848014 /* FadeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FadeViewController.h; sourceTree = ""; }; 100 | 0BFEF8E51A33BA4A00848014 /* FadeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FadeViewController.m; sourceTree = ""; }; 101 | /* End PBXFileReference section */ 102 | 103 | /* Begin PBXFrameworksBuildPhase section */ 104 | 0B0069991A1E4F7200A2DC35 /* Frameworks */ = { 105 | isa = PBXFrameworksBuildPhase; 106 | buildActionMask = 2147483647; 107 | files = ( 108 | ); 109 | runOnlyForDeploymentPostprocessing = 0; 110 | }; 111 | 0B0069B21A1E4F7200A2DC35 /* Frameworks */ = { 112 | isa = PBXFrameworksBuildPhase; 113 | buildActionMask = 2147483647; 114 | files = ( 115 | ); 116 | runOnlyForDeploymentPostprocessing = 0; 117 | }; 118 | /* End PBXFrameworksBuildPhase section */ 119 | 120 | /* Begin PBXGroup section */ 121 | 0B0069931A1E4F7200A2DC35 = { 122 | isa = PBXGroup; 123 | children = ( 124 | 0B00699E1A1E4F7200A2DC35 /* ModalityExample */, 125 | 0B0069B81A1E4F7200A2DC35 /* ModalityExampleTests */, 126 | 0B00699D1A1E4F7200A2DC35 /* Products */, 127 | ); 128 | sourceTree = ""; 129 | }; 130 | 0B00699D1A1E4F7200A2DC35 /* Products */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 0B00699C1A1E4F7200A2DC35 /* ModalityExample.app */, 134 | 0B0069B51A1E4F7200A2DC35 /* ModalityExampleTests.xctest */, 135 | ); 136 | name = Products; 137 | sourceTree = ""; 138 | }; 139 | 0B00699E1A1E4F7200A2DC35 /* ModalityExample */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 0BFEF8E01A33725F00848014 /* ViewControllers */, 143 | 0BFEF8CE1A33669800848014 /* Application */, 144 | 0BFEF8D41A33669800848014 /* Views */, 145 | 0B0069C51A1E504000A2DC35 /* Modality */, 146 | 0B0069AC1A1E4F7200A2DC35 /* Images.xcassets */, 147 | 0B00699F1A1E4F7200A2DC35 /* Supporting Files */, 148 | ); 149 | path = ModalityExample; 150 | sourceTree = ""; 151 | }; 152 | 0B00699F1A1E4F7200A2DC35 /* Supporting Files */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 0B0069A01A1E4F7200A2DC35 /* Info.plist */, 156 | 0B0069A11A1E4F7200A2DC35 /* main.m */, 157 | ); 158 | name = "Supporting Files"; 159 | sourceTree = ""; 160 | }; 161 | 0B0069B81A1E4F7200A2DC35 /* ModalityExampleTests */ = { 162 | isa = PBXGroup; 163 | children = ( 164 | 0B0069BB1A1E4F7200A2DC35 /* ModalityExampleTests.m */, 165 | 0B0069B91A1E4F7200A2DC35 /* Supporting Files */, 166 | ); 167 | path = ModalityExampleTests; 168 | sourceTree = ""; 169 | }; 170 | 0B0069B91A1E4F7200A2DC35 /* Supporting Files */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 0B0069BA1A1E4F7200A2DC35 /* Info.plist */, 174 | ); 175 | name = "Supporting Files"; 176 | sourceTree = ""; 177 | }; 178 | 0B0069C51A1E504000A2DC35 /* Modality */ = { 179 | isa = PBXGroup; 180 | children = ( 181 | 0B0069C61A1E504000A2DC35 /* Categories */, 182 | 0B0069C91A1E504000A2DC35 /* Definitions */, 183 | 0B0069D01A1E504000A2DC35 /* Factories */, 184 | 0B0069F01A1E6AC400A2DC35 /* Protocols */, 185 | 0B0069D31A1E504000A2DC35 /* Helpers */, 186 | 0B0069E11A1E504000A2DC35 /* Transitioning */, 187 | ); 188 | name = Modality; 189 | path = ../../Modality; 190 | sourceTree = ""; 191 | }; 192 | 0B0069C61A1E504000A2DC35 /* Categories */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | 0B0069C71A1E504000A2DC35 /* UIViewController+Modality.h */, 196 | 0B0069C81A1E504000A2DC35 /* UIViewController+Modality.m */, 197 | ); 198 | path = Categories; 199 | sourceTree = ""; 200 | }; 201 | 0B0069C91A1E504000A2DC35 /* Definitions */ = { 202 | isa = PBXGroup; 203 | children = ( 204 | 0B0069CA1A1E504000A2DC35 /* MODDefaults.h */, 205 | 0B0069CB1A1E504000A2DC35 /* MODDirection.h */, 206 | 0B0069CD1A1E504000A2DC35 /* MODTransitionType.h */, 207 | ); 208 | path = Definitions; 209 | sourceTree = ""; 210 | }; 211 | 0B0069D01A1E504000A2DC35 /* Factories */ = { 212 | isa = PBXGroup; 213 | children = ( 214 | 0B0069D11A1E504000A2DC35 /* MODTransformFactory.h */, 215 | 0B0069D21A1E504000A2DC35 /* MODTransformFactory.m */, 216 | ); 217 | path = Factories; 218 | sourceTree = ""; 219 | }; 220 | 0B0069D31A1E504000A2DC35 /* Helpers */ = { 221 | isa = PBXGroup; 222 | children = ( 223 | 0B0069D41A1E504000A2DC35 /* MODModalHelper.h */, 224 | 0B0069D51A1E504000A2DC35 /* MODModalHelper.m */, 225 | 0B0069D61A1E504000A2DC35 /* MODPropertiesHelper.h */, 226 | 0B0069D71A1E504000A2DC35 /* MODPropertiesHelper.m */, 227 | 0B0069DC1A1E504000A2DC35 /* MODViewHelper.h */, 228 | 0B0069DD1A1E504000A2DC35 /* MODViewHelper.m */, 229 | ); 230 | path = Helpers; 231 | sourceTree = ""; 232 | }; 233 | 0B0069E11A1E504000A2DC35 /* Transitioning */ = { 234 | isa = PBXGroup; 235 | children = ( 236 | 0B0069FC1A1E772A00A2DC35 /* TransitionAnimators */, 237 | 0B0069F21A1E6DFC00A2DC35 /* Base */, 238 | ); 239 | path = Transitioning; 240 | sourceTree = ""; 241 | }; 242 | 0B0069F01A1E6AC400A2DC35 /* Protocols */ = { 243 | isa = PBXGroup; 244 | children = ( 245 | 0B0069F11A1E6AC400A2DC35 /* MODTransitionAnimator.h */, 246 | ); 247 | path = Protocols; 248 | sourceTree = ""; 249 | }; 250 | 0B0069F21A1E6DFC00A2DC35 /* Base */ = { 251 | isa = PBXGroup; 252 | children = ( 253 | 0B0069F31A1E6DFC00A2DC35 /* MODTransitioningBase.h */, 254 | 0B0069F41A1E6DFC00A2DC35 /* MODTransitioningBase.m */, 255 | 0B0069F61A1E6E4900A2DC35 /* MODModalTransitioningBase.h */, 256 | 0B0069F71A1E6E4900A2DC35 /* MODModalTransitioningBase.m */, 257 | 0B0069F91A1E6F8E00A2DC35 /* MODDirectionalTransitioningBase.h */, 258 | 0B0069FA1A1E6F8E00A2DC35 /* MODDirectionalTransitioningBase.m */, 259 | ); 260 | path = Base; 261 | sourceTree = ""; 262 | }; 263 | 0B0069FC1A1E772A00A2DC35 /* TransitionAnimators */ = { 264 | isa = PBXGroup; 265 | children = ( 266 | 0B0069FD1A1E772A00A2DC35 /* MODTransitionAnimatorSlideModal.h */, 267 | 0B0069FE1A1E772A00A2DC35 /* MODTransitionAnimatorSlideModal.m */, 268 | 0B006A001A1E78C000A2DC35 /* MODTransitionAnimatorCarryOver.h */, 269 | 0B006A011A1E78C000A2DC35 /* MODTransitionAnimatorCarryOver.m */, 270 | 0BCB1E901A27EBF300DB8843 /* MODTransitionAnimatorFade.h */, 271 | 0BCB1E911A27EBF300DB8843 /* MODTransitionAnimatorFade.m */, 272 | 0B7E6CBD1A2A91F40011B187 /* MODTransitionAnimatorMask.h */, 273 | 0B7E6CBE1A2A91F40011B187 /* MODTransitionAnimatorMask.m */, 274 | 0BFEF8CB1A333AB700848014 /* MODTransitionAnimatorFlipModal.h */, 275 | 0BFEF8CC1A333AB700848014 /* MODTransitionAnimatorFlipModal.m */, 276 | ); 277 | path = TransitionAnimators; 278 | sourceTree = ""; 279 | }; 280 | 0BFEF8CE1A33669800848014 /* Application */ = { 281 | isa = PBXGroup; 282 | children = ( 283 | 0BFEF8CF1A33669800848014 /* AppDelegate.h */, 284 | 0BFEF8D01A33669800848014 /* AppDelegate.m */, 285 | ); 286 | path = Application; 287 | sourceTree = ""; 288 | }; 289 | 0BFEF8D41A33669800848014 /* Views */ = { 290 | isa = PBXGroup; 291 | children = ( 292 | 0B0069A91A1E4F7200A2DC35 /* Main.storyboard */, 293 | 0B0069AE1A1E4F7200A2DC35 /* LaunchScreen.xib */, 294 | 0BFEF8D71A3366BB00848014 /* DIrectionLabel.h */, 295 | 0BFEF8D81A3366BB00848014 /* DIrectionLabel.m */, 296 | 0BFEF8DA1A33698C00848014 /* CellContentView.h */, 297 | 0BFEF8DB1A33698C00848014 /* CellContentView.m */, 298 | 0B95B7371A33C6A50091D704 /* DirectionButton.h */, 299 | 0B95B7381A33C6A50091D704 /* DirectionButton.m */, 300 | ); 301 | path = Views; 302 | sourceTree = ""; 303 | }; 304 | 0BFEF8E01A33725F00848014 /* ViewControllers */ = { 305 | isa = PBXGroup; 306 | children = ( 307 | 0BFEF8E11A33726700848014 /* TableViewController.h */, 308 | 0BFEF8E21A33726700848014 /* TableViewController.m */, 309 | 0BFEF8E41A33BA4A00848014 /* FadeViewController.h */, 310 | 0BFEF8E51A33BA4A00848014 /* FadeViewController.m */, 311 | 0B95B7341A33C4770091D704 /* CarryOverViewController.h */, 312 | 0B95B7351A33C4770091D704 /* CarryOverViewController.m */, 313 | ); 314 | path = ViewControllers; 315 | sourceTree = ""; 316 | }; 317 | /* End PBXGroup section */ 318 | 319 | /* Begin PBXNativeTarget section */ 320 | 0B00699B1A1E4F7200A2DC35 /* ModalityExample */ = { 321 | isa = PBXNativeTarget; 322 | buildConfigurationList = 0B0069BF1A1E4F7200A2DC35 /* Build configuration list for PBXNativeTarget "ModalityExample" */; 323 | buildPhases = ( 324 | 0B0069981A1E4F7200A2DC35 /* Sources */, 325 | 0B0069991A1E4F7200A2DC35 /* Frameworks */, 326 | 0B00699A1A1E4F7200A2DC35 /* Resources */, 327 | ); 328 | buildRules = ( 329 | ); 330 | dependencies = ( 331 | ); 332 | name = ModalityExample; 333 | productName = ModalityExample; 334 | productReference = 0B00699C1A1E4F7200A2DC35 /* ModalityExample.app */; 335 | productType = "com.apple.product-type.application"; 336 | }; 337 | 0B0069B41A1E4F7200A2DC35 /* ModalityExampleTests */ = { 338 | isa = PBXNativeTarget; 339 | buildConfigurationList = 0B0069C21A1E4F7200A2DC35 /* Build configuration list for PBXNativeTarget "ModalityExampleTests" */; 340 | buildPhases = ( 341 | 0B0069B11A1E4F7200A2DC35 /* Sources */, 342 | 0B0069B21A1E4F7200A2DC35 /* Frameworks */, 343 | 0B0069B31A1E4F7200A2DC35 /* Resources */, 344 | ); 345 | buildRules = ( 346 | ); 347 | dependencies = ( 348 | 0B0069B71A1E4F7200A2DC35 /* PBXTargetDependency */, 349 | ); 350 | name = ModalityExampleTests; 351 | productName = ModalityExampleTests; 352 | productReference = 0B0069B51A1E4F7200A2DC35 /* ModalityExampleTests.xctest */; 353 | productType = "com.apple.product-type.bundle.unit-test"; 354 | }; 355 | /* End PBXNativeTarget section */ 356 | 357 | /* Begin PBXProject section */ 358 | 0B0069941A1E4F7200A2DC35 /* Project object */ = { 359 | isa = PBXProject; 360 | attributes = { 361 | LastUpgradeCheck = 0610; 362 | ORGANIZATIONNAME = "Kevin Wong"; 363 | TargetAttributes = { 364 | 0B00699B1A1E4F7200A2DC35 = { 365 | CreatedOnToolsVersion = 6.1; 366 | }; 367 | 0B0069B41A1E4F7200A2DC35 = { 368 | CreatedOnToolsVersion = 6.1; 369 | TestTargetID = 0B00699B1A1E4F7200A2DC35; 370 | }; 371 | }; 372 | }; 373 | buildConfigurationList = 0B0069971A1E4F7200A2DC35 /* Build configuration list for PBXProject "ModalityExample" */; 374 | compatibilityVersion = "Xcode 3.2"; 375 | developmentRegion = English; 376 | hasScannedForEncodings = 0; 377 | knownRegions = ( 378 | en, 379 | Base, 380 | ); 381 | mainGroup = 0B0069931A1E4F7200A2DC35; 382 | productRefGroup = 0B00699D1A1E4F7200A2DC35 /* Products */; 383 | projectDirPath = ""; 384 | projectRoot = ""; 385 | targets = ( 386 | 0B00699B1A1E4F7200A2DC35 /* ModalityExample */, 387 | 0B0069B41A1E4F7200A2DC35 /* ModalityExampleTests */, 388 | ); 389 | }; 390 | /* End PBXProject section */ 391 | 392 | /* Begin PBXResourcesBuildPhase section */ 393 | 0B00699A1A1E4F7200A2DC35 /* Resources */ = { 394 | isa = PBXResourcesBuildPhase; 395 | buildActionMask = 2147483647; 396 | files = ( 397 | 0B0069AB1A1E4F7200A2DC35 /* Main.storyboard in Resources */, 398 | 0B0069B01A1E4F7200A2DC35 /* LaunchScreen.xib in Resources */, 399 | 0B0069AD1A1E4F7200A2DC35 /* Images.xcassets in Resources */, 400 | ); 401 | runOnlyForDeploymentPostprocessing = 0; 402 | }; 403 | 0B0069B31A1E4F7200A2DC35 /* Resources */ = { 404 | isa = PBXResourcesBuildPhase; 405 | buildActionMask = 2147483647; 406 | files = ( 407 | ); 408 | runOnlyForDeploymentPostprocessing = 0; 409 | }; 410 | /* End PBXResourcesBuildPhase section */ 411 | 412 | /* Begin PBXSourcesBuildPhase section */ 413 | 0B0069981A1E4F7200A2DC35 /* Sources */ = { 414 | isa = PBXSourcesBuildPhase; 415 | buildActionMask = 2147483647; 416 | files = ( 417 | 0B95B7391A33C6A50091D704 /* DirectionButton.m in Sources */, 418 | 0B0069E81A1E504000A2DC35 /* MODModalHelper.m in Sources */, 419 | 0B7E6CBF1A2A91F40011B187 /* MODTransitionAnimatorMask.m in Sources */, 420 | 0BFEF8CD1A333AB700848014 /* MODTransitionAnimatorFlipModal.m in Sources */, 421 | 0B0069E91A1E504000A2DC35 /* MODPropertiesHelper.m in Sources */, 422 | 0B0069E61A1E504000A2DC35 /* UIViewController+Modality.m in Sources */, 423 | 0B0069FF1A1E772A00A2DC35 /* MODTransitionAnimatorSlideModal.m in Sources */, 424 | 0BFEF8E61A33BA4A00848014 /* FadeViewController.m in Sources */, 425 | 0B0069FB1A1E6F8E00A2DC35 /* MODDirectionalTransitioningBase.m in Sources */, 426 | 0B0069EC1A1E504000A2DC35 /* MODViewHelper.m in Sources */, 427 | 0B0069F51A1E6DFC00A2DC35 /* MODTransitioningBase.m in Sources */, 428 | 0BFEF8D91A3366BB00848014 /* DIrectionLabel.m in Sources */, 429 | 0B0069A21A1E4F7200A2DC35 /* main.m in Sources */, 430 | 0BCB1E921A27EBF300DB8843 /* MODTransitionAnimatorFade.m in Sources */, 431 | 0B0069F81A1E6E4900A2DC35 /* MODModalTransitioningBase.m in Sources */, 432 | 0BFEF8DC1A33698C00848014 /* CellContentView.m in Sources */, 433 | 0B0069E71A1E504000A2DC35 /* MODTransformFactory.m in Sources */, 434 | 0B95B7361A33C4770091D704 /* CarryOverViewController.m in Sources */, 435 | 0BFEF8E31A33726700848014 /* TableViewController.m in Sources */, 436 | 0B006A021A1E78C000A2DC35 /* MODTransitionAnimatorCarryOver.m in Sources */, 437 | 0BFEF8D51A33669800848014 /* AppDelegate.m in Sources */, 438 | ); 439 | runOnlyForDeploymentPostprocessing = 0; 440 | }; 441 | 0B0069B11A1E4F7200A2DC35 /* Sources */ = { 442 | isa = PBXSourcesBuildPhase; 443 | buildActionMask = 2147483647; 444 | files = ( 445 | 0B0069BC1A1E4F7200A2DC35 /* ModalityExampleTests.m in Sources */, 446 | ); 447 | runOnlyForDeploymentPostprocessing = 0; 448 | }; 449 | /* End PBXSourcesBuildPhase section */ 450 | 451 | /* Begin PBXTargetDependency section */ 452 | 0B0069B71A1E4F7200A2DC35 /* PBXTargetDependency */ = { 453 | isa = PBXTargetDependency; 454 | target = 0B00699B1A1E4F7200A2DC35 /* ModalityExample */; 455 | targetProxy = 0B0069B61A1E4F7200A2DC35 /* PBXContainerItemProxy */; 456 | }; 457 | /* End PBXTargetDependency section */ 458 | 459 | /* Begin PBXVariantGroup section */ 460 | 0B0069A91A1E4F7200A2DC35 /* Main.storyboard */ = { 461 | isa = PBXVariantGroup; 462 | children = ( 463 | 0B0069AA1A1E4F7200A2DC35 /* Base */, 464 | ); 465 | name = Main.storyboard; 466 | path = ..; 467 | sourceTree = ""; 468 | }; 469 | 0B0069AE1A1E4F7200A2DC35 /* LaunchScreen.xib */ = { 470 | isa = PBXVariantGroup; 471 | children = ( 472 | 0B0069AF1A1E4F7200A2DC35 /* Base */, 473 | ); 474 | name = LaunchScreen.xib; 475 | path = ..; 476 | sourceTree = ""; 477 | }; 478 | /* End PBXVariantGroup section */ 479 | 480 | /* Begin XCBuildConfiguration section */ 481 | 0B0069BD1A1E4F7200A2DC35 /* Debug */ = { 482 | isa = XCBuildConfiguration; 483 | buildSettings = { 484 | ALWAYS_SEARCH_USER_PATHS = NO; 485 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 486 | CLANG_CXX_LIBRARY = "libc++"; 487 | CLANG_ENABLE_MODULES = YES; 488 | CLANG_ENABLE_OBJC_ARC = YES; 489 | CLANG_WARN_BOOL_CONVERSION = YES; 490 | CLANG_WARN_CONSTANT_CONVERSION = YES; 491 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 492 | CLANG_WARN_EMPTY_BODY = YES; 493 | CLANG_WARN_ENUM_CONVERSION = YES; 494 | CLANG_WARN_INT_CONVERSION = YES; 495 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 496 | CLANG_WARN_UNREACHABLE_CODE = YES; 497 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 498 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 499 | COPY_PHASE_STRIP = NO; 500 | ENABLE_STRICT_OBJC_MSGSEND = YES; 501 | GCC_C_LANGUAGE_STANDARD = gnu99; 502 | GCC_DYNAMIC_NO_PIC = NO; 503 | GCC_OPTIMIZATION_LEVEL = 0; 504 | GCC_PREPROCESSOR_DEFINITIONS = ( 505 | "DEBUG=1", 506 | "$(inherited)", 507 | ); 508 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 509 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 510 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 511 | GCC_WARN_UNDECLARED_SELECTOR = YES; 512 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 513 | GCC_WARN_UNUSED_FUNCTION = YES; 514 | GCC_WARN_UNUSED_VARIABLE = YES; 515 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 516 | MTL_ENABLE_DEBUG_INFO = YES; 517 | ONLY_ACTIVE_ARCH = YES; 518 | SDKROOT = iphoneos; 519 | TARGETED_DEVICE_FAMILY = "1,2"; 520 | }; 521 | name = Debug; 522 | }; 523 | 0B0069BE1A1E4F7200A2DC35 /* Release */ = { 524 | isa = XCBuildConfiguration; 525 | buildSettings = { 526 | ALWAYS_SEARCH_USER_PATHS = NO; 527 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 528 | CLANG_CXX_LIBRARY = "libc++"; 529 | CLANG_ENABLE_MODULES = YES; 530 | CLANG_ENABLE_OBJC_ARC = YES; 531 | CLANG_WARN_BOOL_CONVERSION = YES; 532 | CLANG_WARN_CONSTANT_CONVERSION = YES; 533 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 534 | CLANG_WARN_EMPTY_BODY = YES; 535 | CLANG_WARN_ENUM_CONVERSION = YES; 536 | CLANG_WARN_INT_CONVERSION = YES; 537 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 538 | CLANG_WARN_UNREACHABLE_CODE = YES; 539 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 540 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 541 | COPY_PHASE_STRIP = YES; 542 | ENABLE_NS_ASSERTIONS = NO; 543 | ENABLE_STRICT_OBJC_MSGSEND = YES; 544 | GCC_C_LANGUAGE_STANDARD = gnu99; 545 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 546 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 547 | GCC_WARN_UNDECLARED_SELECTOR = YES; 548 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 549 | GCC_WARN_UNUSED_FUNCTION = YES; 550 | GCC_WARN_UNUSED_VARIABLE = YES; 551 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 552 | MTL_ENABLE_DEBUG_INFO = NO; 553 | SDKROOT = iphoneos; 554 | TARGETED_DEVICE_FAMILY = "1,2"; 555 | VALIDATE_PRODUCT = YES; 556 | }; 557 | name = Release; 558 | }; 559 | 0B0069C01A1E4F7200A2DC35 /* Debug */ = { 560 | isa = XCBuildConfiguration; 561 | buildSettings = { 562 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 563 | INFOPLIST_FILE = ModalityExample/Info.plist; 564 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 565 | PRODUCT_NAME = "$(TARGET_NAME)"; 566 | }; 567 | name = Debug; 568 | }; 569 | 0B0069C11A1E4F7200A2DC35 /* Release */ = { 570 | isa = XCBuildConfiguration; 571 | buildSettings = { 572 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 573 | INFOPLIST_FILE = ModalityExample/Info.plist; 574 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 575 | PRODUCT_NAME = "$(TARGET_NAME)"; 576 | }; 577 | name = Release; 578 | }; 579 | 0B0069C31A1E4F7200A2DC35 /* Debug */ = { 580 | isa = XCBuildConfiguration; 581 | buildSettings = { 582 | BUNDLE_LOADER = "$(TEST_HOST)"; 583 | FRAMEWORK_SEARCH_PATHS = ( 584 | "$(SDKROOT)/Developer/Library/Frameworks", 585 | "$(inherited)", 586 | ); 587 | GCC_PREPROCESSOR_DEFINITIONS = ( 588 | "DEBUG=1", 589 | "$(inherited)", 590 | ); 591 | INFOPLIST_FILE = ModalityExampleTests/Info.plist; 592 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 593 | PRODUCT_NAME = "$(TARGET_NAME)"; 594 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ModalityExample.app/ModalityExample"; 595 | }; 596 | name = Debug; 597 | }; 598 | 0B0069C41A1E4F7200A2DC35 /* Release */ = { 599 | isa = XCBuildConfiguration; 600 | buildSettings = { 601 | BUNDLE_LOADER = "$(TEST_HOST)"; 602 | FRAMEWORK_SEARCH_PATHS = ( 603 | "$(SDKROOT)/Developer/Library/Frameworks", 604 | "$(inherited)", 605 | ); 606 | INFOPLIST_FILE = ModalityExampleTests/Info.plist; 607 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 608 | PRODUCT_NAME = "$(TARGET_NAME)"; 609 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ModalityExample.app/ModalityExample"; 610 | }; 611 | name = Release; 612 | }; 613 | /* End XCBuildConfiguration section */ 614 | 615 | /* Begin XCConfigurationList section */ 616 | 0B0069971A1E4F7200A2DC35 /* Build configuration list for PBXProject "ModalityExample" */ = { 617 | isa = XCConfigurationList; 618 | buildConfigurations = ( 619 | 0B0069BD1A1E4F7200A2DC35 /* Debug */, 620 | 0B0069BE1A1E4F7200A2DC35 /* Release */, 621 | ); 622 | defaultConfigurationIsVisible = 0; 623 | defaultConfigurationName = Release; 624 | }; 625 | 0B0069BF1A1E4F7200A2DC35 /* Build configuration list for PBXNativeTarget "ModalityExample" */ = { 626 | isa = XCConfigurationList; 627 | buildConfigurations = ( 628 | 0B0069C01A1E4F7200A2DC35 /* Debug */, 629 | 0B0069C11A1E4F7200A2DC35 /* Release */, 630 | ); 631 | defaultConfigurationIsVisible = 0; 632 | defaultConfigurationName = Release; 633 | }; 634 | 0B0069C21A1E4F7200A2DC35 /* Build configuration list for PBXNativeTarget "ModalityExampleTests" */ = { 635 | isa = XCConfigurationList; 636 | buildConfigurations = ( 637 | 0B0069C31A1E4F7200A2DC35 /* Debug */, 638 | 0B0069C41A1E4F7200A2DC35 /* Release */, 639 | ); 640 | defaultConfigurationIsVisible = 0; 641 | defaultConfigurationName = Release; 642 | }; 643 | /* End XCConfigurationList section */ 644 | }; 645 | rootObject = 0B0069941A1E4F7200A2DC35 /* Project object */; 646 | } 647 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Application/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. 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 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Application/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 66 | 67 | 68 | 69 | 81 | 93 | 105 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 165 | 166 | 167 | 168 | 180 | 192 | 204 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 264 | 265 | 266 | 267 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 323 | 324 | 325 | 326 | 338 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 394 | 395 | 396 | 397 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 455 | 456 | 457 | 458 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | 531 | 532 | 533 | 534 | 535 | 536 | 537 | 538 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 612 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 675 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Images.xcassets/circleMask.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "circleMask.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Images.xcassets/circleMask.imageset/circleMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinwl02/Modality/873b6650d701de7ec4858ef1e3c60672aecc062a/ModalityExample/ModalityExample/Images.xcassets/circleMask.imageset/circleMask.png -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Images.xcassets/logo.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 | "scale" : "3x", 14 | "filename" : "logoBig.png" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Images.xcassets/logo.imageset/logoBig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinwl02/Modality/873b6650d701de7ec4858ef1e3c60672aecc062a/ModalityExample/ModalityExample/Images.xcassets/logo.imageset/logoBig.png -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Images.xcassets/starMask.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "starMask.png" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Images.xcassets/starMask.imageset/starMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kevinwl02/Modality/873b6650d701de7ec4858ef1e3c60672aecc062a/ModalityExample/ModalityExample/Images.xcassets/starMask.imageset/starMask.png -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.github.kevinwl02.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/ViewControllers/CarryOverViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // CarryOverViewController.h 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 07/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "MODTransitionAnimatorCarryOver.h" 11 | 12 | @interface CarryOverViewController : UIViewController 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/ViewControllers/CarryOverViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // CarryOverViewController.m 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 07/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "CarryOverViewController.h" 10 | 11 | @interface CarryOverViewController () 12 | 13 | @property (weak, nonatomic) IBOutlet UIView *containerView; 14 | 15 | @end 16 | 17 | @implementation CarryOverViewController 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | 22 | } 23 | 24 | #pragma mark - UI 25 | 26 | - (IBAction)goBackPressed:(id)sender { 27 | 28 | [self dismissViewControllerAnimated:YES completion:nil]; 29 | } 30 | 31 | #pragma mark - MODCarryOverDestinationDelegate 32 | 33 | - (UIView *)destinationContainerForTransitionAnimator { 34 | 35 | return self.containerView; 36 | } 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/ViewControllers/FadeViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // FadeViewController.h 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface FadeViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/ViewControllers/FadeViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // FadeViewController.m 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "FadeViewController.h" 10 | #import "DirectionButton.h" 11 | 12 | @interface FadeViewController () 13 | 14 | @property (weak, nonatomic) IBOutlet DirectionButton *okButton; 15 | 16 | @end 17 | 18 | @implementation FadeViewController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | [self.okButton addTarget:self action:@selector(okButtonPressed) forControlEvents:UIControlEventTouchUpInside]; 23 | } 24 | 25 | - (void)okButtonPressed { 26 | 27 | [self dismissViewControllerAnimated:YES completion:nil]; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/ViewControllers/TableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.h 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TableViewController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/ViewControllers/TableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TableViewController.m 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "TableViewController.h" 10 | #import "DirectionButton.h" 11 | #import "MODTransitionAnimatorSlideModal.h" 12 | #import "MODTransitionAnimatorFlipModal.h" 13 | #import "MODTransitionAnimatorFade.h" 14 | #import "MODTransitionAnimatorMask.h" 15 | #import "MODTransitionAnimatorCarryOver.h" 16 | #import "CarryOverViewController.h" 17 | 18 | @interface TableViewController () 19 | 20 | @property (weak, nonatomic) IBOutlet DirectionButton *slideUp; 21 | @property (weak, nonatomic) IBOutlet DirectionButton *slideDown; 22 | @property (weak, nonatomic) IBOutlet DirectionButton *slideRight; 23 | @property (weak, nonatomic) IBOutlet DirectionButton *slideLeft; 24 | 25 | @property (weak, nonatomic) IBOutlet DirectionButton *flipUp; 26 | @property (weak, nonatomic) IBOutlet DirectionButton *flipRight; 27 | @property (weak, nonatomic) IBOutlet DirectionButton *flipLeft; 28 | @property (weak, nonatomic) IBOutlet DirectionButton *flipDown; 29 | 30 | @property (weak, nonatomic) IBOutlet DirectionButton *fade; 31 | 32 | @property (weak, nonatomic) IBOutlet DirectionButton *mask1; 33 | @property (weak, nonatomic) IBOutlet DirectionButton *mask2; 34 | 35 | @property (weak, nonatomic) IBOutlet DirectionButton *carryOver; 36 | @property (weak, nonatomic) IBOutlet UIView *carryOverView; 37 | 38 | @end 39 | 40 | @implementation TableViewController 41 | 42 | - (void)viewDidLoad { 43 | 44 | [super viewDidLoad]; 45 | [self setupInput]; 46 | } 47 | 48 | #pragma mark - Input setup 49 | 50 | - (void)setupInput { 51 | 52 | [self setupSlide]; 53 | [self setupFlip]; 54 | [self setupMask]; 55 | } 56 | 57 | - (void)setupSlide { 58 | self.slideUp.tag = MODDirectionTop; 59 | [self.slideUp addTarget:self action:@selector(slideModal:) forControlEvents:UIControlEventTouchUpInside]; 60 | self.slideDown.tag = MODDirectionBottom; 61 | [self.slideDown addTarget:self action:@selector(slideModal:) forControlEvents:UIControlEventTouchUpInside]; 62 | self.slideRight.tag = MODDirectionRight; 63 | [self.slideRight addTarget:self action:@selector(slideModal:) forControlEvents:UIControlEventTouchUpInside]; 64 | self.slideLeft.tag = MODDirectionLeft; 65 | [self.slideLeft addTarget:self action:@selector(slideModal:) forControlEvents:UIControlEventTouchUpInside]; 66 | } 67 | 68 | - (void)setupFlip { 69 | self.flipUp.tag = MODDirectionTop; 70 | [self.flipUp addTarget:self action:@selector(flipModal:) forControlEvents:UIControlEventTouchUpInside]; 71 | self.flipDown.tag = MODDirectionBottom; 72 | [self.flipDown addTarget:self action:@selector(flipModal:) forControlEvents:UIControlEventTouchUpInside]; 73 | self.flipRight.tag = MODDirectionRight; 74 | [self.flipRight addTarget:self action:@selector(flipModal:) forControlEvents:UIControlEventTouchUpInside]; 75 | self.flipLeft.tag = MODDirectionLeft; 76 | [self.flipLeft addTarget:self action:@selector(flipModal:) forControlEvents:UIControlEventTouchUpInside]; 77 | } 78 | 79 | - (void)setupMask { 80 | 81 | self.mask1.tag = 0; 82 | [self.mask1 addTarget:self action:@selector(maskPressed:) forControlEvents:UIControlEventTouchUpInside]; 83 | self.mask2.tag = 1; 84 | [self.mask2 addTarget:self action:@selector(maskPressed:) forControlEvents:UIControlEventTouchUpInside]; 85 | } 86 | 87 | #pragma mark - Navigation 88 | 89 | /** 90 | * This is how to add transitions when the view controllers are presented 91 | * manually. 92 | * 93 | */ 94 | - (void)slideModal:(UIButton *)button { 95 | 96 | UIViewController *modalController = [self.storyboard instantiateViewControllerWithIdentifier:@"ModalViewController"]; 97 | 98 | CGFloat viewLength = 150; 99 | if (button.tag == MODDirectionLeft || button.tag == MODDirectionRight) { 100 | viewLength = self.view.bounds.size.width; 101 | } 102 | 103 | MODTransitionAnimatorSlideModal *animator = [MODTransitionAnimatorSlideModal transitionAnimatorWithDirection:button.tag destinationViewLength:viewLength]; 104 | [self MOD_presentViewController:modalController withTransitionAnimator:animator duration:MODDefaulTransitionDuration completion:nil]; 105 | } 106 | 107 | - (void)flipModal:(UIButton *)button { 108 | 109 | UIViewController *modalController = [self.storyboard instantiateViewControllerWithIdentifier:@"ModalViewController"]; 110 | 111 | CGFloat viewLength = 150; 112 | if (button.tag == MODDirectionLeft || button.tag == MODDirectionRight) { 113 | viewLength = self.view.bounds.size.width; 114 | } 115 | 116 | MODTransitionAnimatorFlipModal *animator = [MODTransitionAnimatorFlipModal transitionAnimatorWithDirection:button.tag destinationViewLength:viewLength]; 117 | [self MOD_presentViewController:modalController withTransitionAnimator:animator duration:MODDefaulTransitionDuration completion:nil]; 118 | } 119 | 120 | - (void)maskPressed:(UIButton *)button { 121 | 122 | UIImage *maskImage = nil; 123 | if (button.tag == 0) { 124 | maskImage = [UIImage imageNamed:@"circleMask"]; 125 | } 126 | else if (button.tag == 1) { 127 | maskImage = [UIImage imageNamed:@"starMask"]; 128 | } 129 | 130 | UIViewController *destinationViewContorller = [self.storyboard instantiateViewControllerWithIdentifier:@"LogoViewController"]; 131 | MODTransitionAnimatorMask *animator = [MODTransitionAnimatorMask transitionAnimatorWithMaskImage:maskImage]; 132 | [self MOD_presentViewController:destinationViewContorller withTransitionAnimator:animator duration:MODDefaulTransitionDuration completion:nil]; 133 | } 134 | 135 | /** 136 | * This is how to do it when navigating through segues. 137 | * 138 | */ 139 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 140 | 141 | if ([segue.identifier isEqualToString:@"FadeSegue"]) { 142 | 143 | MODTransitionAnimatorFade *animator = [MODTransitionAnimatorFade transitionAnimatior]; 144 | UIViewController *destinationController = segue.destinationViewController; 145 | [destinationController MOD_animateWithTransitionAnimator:animator duration:MODDefaulTransitionDuration]; 146 | } 147 | else if ([segue.identifier isEqualToString:@"CarryOverSegue"]) { 148 | 149 | CarryOverViewController *destinationController = segue.destinationViewController; 150 | MODTransitionAnimatorCarryOver *animator = [MODTransitionAnimatorCarryOver transitionAnimatorWithCarryOverView:self.carryOverView destinationDelegate:destinationController]; 151 | [destinationController MOD_animateWithTransitionAnimator:animator duration:MODDefaulTransitionDuration]; 152 | } 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Views/CellContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // CellContentView.h 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface CellContentView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Views/CellContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // CellContentView.m 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "CellContentView.h" 10 | 11 | @implementation CellContentView 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | [self setupView]; 16 | } 17 | 18 | #pragma mark - Private methods 19 | 20 | - (void)setupView { 21 | 22 | self.layer.cornerRadius = 3; 23 | self.layer.shadowColor = [UIColor colorWithWhite:0 alpha:1].CGColor; 24 | self.layer.shadowOpacity = 0.15; 25 | self.layer.shadowRadius = 0; 26 | self.layer.shadowOffset = CGSizeMake(0.5, 1); 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Views/DIrectionLabel.h: -------------------------------------------------------------------------------- 1 | // 2 | // DIrectionLabel.h 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DIrectionLabel : UILabel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Views/DIrectionLabel.m: -------------------------------------------------------------------------------- 1 | // 2 | // DIrectionLabel.m 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "DIrectionLabel.h" 10 | 11 | @implementation DIrectionLabel 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | [self setupView]; 16 | } 17 | 18 | #pragma mark - Private methods 19 | 20 | - (void)setupView { 21 | 22 | self.layer.cornerRadius = self.frame.size.width / 2; 23 | self.layer.borderColor = [UIColor colorWithRed:247/255.0 green:112/255.0 blue:141/255.0 alpha:1].CGColor; 24 | self.layer.borderWidth = 10; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Views/DirectionButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // directionButton.h 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface DirectionButton : UIButton 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/Views/DirectionButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // directionButton.m 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 06/12/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import "DirectionButton.h" 10 | 11 | @implementation DirectionButton 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | [self setupView]; 16 | } 17 | 18 | #pragma mark - Private methods 19 | 20 | - (void)setupView { 21 | 22 | self.layer.cornerRadius = 4; 23 | [self addTarget:self action:@selector(enlargeButton) forControlEvents:UIControlEventTouchDown]; 24 | [self addTarget:self action:@selector(shrinkButton) forControlEvents:UIControlEventTouchUpInside]; 25 | [self addTarget:self action:@selector(shrinkButton) forControlEvents:UIControlEventTouchDragExit]; 26 | } 27 | 28 | - (void)enlargeButton { 29 | 30 | [UIView animateWithDuration:0.1 animations:^{ 31 | self.transform = CGAffineTransformMakeScale(2, 2); 32 | }]; 33 | } 34 | 35 | - (void)shrinkButton { 36 | 37 | [UIView animateWithDuration:0.1 animations:^{ 38 | self.transform = CGAffineTransformIdentity; 39 | }]; 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ModalityExample 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. 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 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.github.kevinwl02.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /ModalityExample/ModalityExampleTests/ModalityExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // ModalityExampleTests.m 3 | // ModalityExampleTests 4 | // 5 | // Created by Kevin on 20/11/14. 6 | // Copyright (c) 2014 Kevin Wong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface ModalityExampleTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation ModalityExampleTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![ModalityLogo](/../github-media/media/logo.png?raw=true) 2 | 3 | Modality is a transitions library to present modal views and includes some cool transition effects. 4 | 5 | ##Example 6 | 7 | ![Modality](/../github-media/media/modality.gif?raw=true) 8 | 9 | The ModalityExample project contains the source code for the example. 10 | 11 | ##Getting started 12 | 13 | Modality is available on [CocoaPods](http://cocoapods.org). 14 | In your `podfile` add: 15 | 16 | ```ruby 17 | pod 'Modality', '~> 0.0.1' 18 | ``` 19 | 20 | ##Usage 21 | 22 | To start a transition, first import a transition animator. Modality currently has the following: 23 | 24 | * `MODTransitionAnimatorSlideModal` 25 | * `MODTransitionAnimatorFlipModal` 26 | * `MODTransitionAnimatorFade` 27 | * `MODTransitionAnimatorMask` 28 | * `MODTransitionAnimatorCarryOver` 29 | 30 | Then, for example, import: 31 | 32 | ```obj-c 33 | #import 34 | ``` 35 | 36 | Each animator will import the required headers to configure the transition. 37 | 38 | ###Creating the transition animator 39 | 40 | Create the transition animator using its factory method: 41 | 42 | ```obj-c 43 | MODTransitionAnimatorSlideModal *animator = [MODTransitionAnimatorSlideModal transitionAnimatorWithDirection:MODDirectionBottom destinationViewLength:200]; 44 | ``` 45 | 46 | ###Setting up the transition 47 | 48 | If you are presenting the view controller manually, do the following (this is a category method for UIViewController): 49 | 50 | ```obj-c 51 | [self MOD_presentViewController:modalController withTransitionAnimator:animator duration:MODDefaulTransitionDuration completion:nil]; 52 | ``` 53 | 54 | Else, if you are presenting through the Storyboard, do the following: 55 | 56 | ```obj-c 57 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 58 | ... 59 | UIViewController *destinationController = segue.destinationViewController; 60 | [destinationController MOD_animateWithTransitionAnimator:animator duration:MODDefaulTransitionDuration]; 61 | ``` 62 | 63 | ##Author 64 | 65 | Comments and suggestions much welcome 66 | 67 | Kevin Wong, [@kevinwl02](https://twitter.com/kevinwl02) 68 | 69 | ##License 70 | 71 | Code distributed under the [MIT license](LICENSE) --------------------------------------------------------------------------------