Custom transition between viewcontrollers holding tableviews

Overview

Build Status CocoaPods Cocoapods Docs Carthage compatible

Custom transition between viewcontrollers holding tableviews. Each cell is animated to simulate a 'wave effect'.

Read more about transitions here and UIKit Dynamics here

Screenshot

AMWaveTransition

Getting Started

Install with CocoaPods

  • Add pod 'AMWaveTransition' to your Podfile
  • Run pod install
  • Run open App.xcworkspace

Install with Carthage

github "andreamazz/AMWaveTransition"

Setup as superclass

  • Subclass AMWaveViewController and override visibleCells or follow these steps:

Setup manually

Implement UINavigationControllerDelegate and this delegate method:

- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController
                                  animationControllerForOperation:(UINavigationControllerOperation)operation
                                               fromViewController:(UIViewController*)fromVC
                                                 toViewController:(UIViewController*)toVC {
    if (operation != UINavigationControllerOperationNone) {
        // Return your preferred transition operation
        return [AMWaveTransition transitionWithOperation:operation];
    }
    return nil;
}

Remember to set your instance as the navigation delegate:

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.navigationController setDelegate:self];
}

- (void)dealloc {
    [self.navigationController setDelegate:nil];
}

Implement th AMWaveTransitioning protocol by returning your tableview's visible cells:

- (NSArray*)visibleCells {
    return [self.tableView visibleCells];
}

Interactive gesture

To implement the interactive gesture create a new property in your view controller:

@property (strong, nonatomic) IBOutlet AMWaveTransition *interactive;

initialize it in your viewDidLoad:

self.interactive = [[AMWaveTransition alloc] init];

Attach the gesture recognizer in your viewDidAppear: and detach it in the viewDidDisappear::

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self.interactive attachInteractiveGestureToNavigationController:self.navigationController];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    [self.interactive detachInteractiveGesture];
}

If the view controller you are transitioning to has no table view, don't implement visibleCells, the library will handle the transition correctly.

As you can see in the sample project, the best results are obtained by setting the view and the cells' background to clearColor, and setting a background color or a background image to the navigation controller.

Author

Andrea Mazzini. I'm available for freelance work, feel free to contact me.

Want to support the development of these free libraries? Buy me a coffee ☕️ via Paypal.

Contributors

Thanks to everyone kind enough to submit a pull request.

MIT License

The MIT License (MIT)

Copyright (c) 2017 Andrea Mazzini

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Comments
  • Crash on Swift Project

    Crash on Swift Project

    Hi Andrea, I'm having problems implementing AMWaveTransition on a Swift project - iOS 8 - Xcode 6.

    The crash message is: -[__NSArrayI setTransform:]: unrecognized selector sent to instance 0x7fba99c5d930

    the crash occurs in this method on the line: [view setTransform:CGAffineTransformMakeTranslation(delta, 0)];

    Any help with this error and implementing in Swift would be greatly appreciated.

    Thanks Rob

    - (void)hideView:(UIView *)view withDelay:(NSTimeInterval)delay andDelta:(float)delta
    {
        void (^animation)() = ^{
            [view setTransform:CGAffineTransformMakeTranslation(delta, 0)];
            [view setAlpha:0];
        };
        void (^completion)(BOOL) = ^(BOOL finished){
            [view setTransform:CGAffineTransformIdentity];
        };
        if (self.transitionType == AMWaveTransitionTypeSubtle) {
            [UIView animateWithDuration:self.duration delay:delay options:UIViewAnimationOptionCurveEaseIn animations:animation completion:completion];
        } else if (self.transitionType == AMWaveTransitionTypeNervous) {
            [UIView animateWithDuration:self.duration delay:delay usingSpringWithDamping:0.75 initialSpringVelocity:1 options:UIViewAnimationOptionCurveEaseIn animations:animation completion:completion];
        } else if (self.transitionType == AMWaveTransitionTypeBounce){
            [UIView animateWithDuration:self.duration delay:delay options:UIViewAnimationOptionCurveEaseInOut animations:animation completion:completion];
        }
    }
    
    opened by robmontesinos 5
  • the background of next view controller turns to be disappeared

    the background of next view controller turns to be disappeared

    please refer to this gist, https://gist.github.com/i0sdev/475262e6de902fd9bca8

    I found this when after updating to 0.5.3.

    The issue is:

    i.e., there two view controllers, the first one (table view) is using AMWaveTransition, tap any cells then push to the second view controller, a normal view controller not table view as a simple sample.

    set background color for the second one, like gray or any.

    run the sample, show the first one view controller correctly, tap and then show the second one, but found the background that's supposed to be gray color disappears instead.

    I downgraded it to 0.5.2, it shows as expected, the gray background on the second view controller.

    Why?

    opened by S1U 4
  • Crash while trying to swipe on table cell

    Crash while trying to swipe on table cell

    Your anim is really cool, I love its and would like to integrate into my project. Everything is ok, but while I trying to swipe quickly on table view cell, it crash. Here is the log and screenshot

    screen shot 2014-10-18 at 11 16 34 pm

    Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 4294967295 beyond bounds [0 .. 0]'
    *** First throw call stack:
    (
        0   CoreFoundation                      0x01476df6 __exceptionPreprocess + 182
        1   libobjc.A.dylib                     0x01100a97 objc_exception_throw + 44
        2   CoreFoundation                      0x0135a1b2 -[__NSArrayI objectAtIndex:] + 210
        3   CoreFoundation                      0x013c5538 -[NSArray objectAtIndexedSubscript:] + 40
        4                               0x00076562 -[AMWaveTransition handlePan:] + 562
        5   UIKit                               0x01c65d27 _UIGestureRecognizerSendActions + 327
        6   UIKit                               0x01c645a4 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 561
        7   UIKit                               0x01c665ed -[UIGestureRecognizer _delayedUpdateGesture] + 60
        8   UIKit                               0x01c69f6a ___UIGestureRecognizerUpdate_block_invoke661 + 57
        9   UIKit                               0x01c69e2d _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
        10  UIKit                               0x01c5dd36 _UIGestureRecognizerUpdate + 3720
        11  UIKit                               0x0187971b -[UIWindow _sendGesturesForEvent:] + 1356
        12  UIKit                               0x0187a57f -[UIWindow sendEvent:] + 769
        13  UIKit                               0x0183faa9 -[UIApplication sendEvent:] + 242
        14  UIKit                               0x0184f8de _UIApplicationHandleEventFromQueueEvent + 20690
        15  UIKit                               0x01824079 _UIApplicationHandleEventQueue + 2206
        16  CoreFoundation                      0x0139a7bf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
        17  CoreFoundation                      0x013902cd __CFRunLoopDoSources0 + 253
        18  CoreFoundation                      0x0138f828 __CFRunLoopRun + 952
        19  CoreFoundation                      0x0138f1ab CFRunLoopRunSpecific + 443
        20  CoreFoundation                      0x0138efdb CFRunLoopRunInMode + 123
        21  GraphicsServices                    0x0480224f GSEventRunModal + 192
        22  GraphicsServices                    0x0480208c GSEventRun + 104
        23  UIKit                               0x01827e16 UIApplicationMain + 1526
        24  Funclip                             0x0002c7ad main + 141
        25  libdyld.dylib                       0x0319dac9 start + 1
        26  ???                                 0x00000001 0x0 + 1
    )
    

    Hope you can take a look and fix Thank

    awaiting feedback 
    opened by purepure 4
  • To VC sometimes jumps on display before animating.

    To VC sometimes jumps on display before animating.

    Sometimes navigating back through nav stack will flash present the 'toVC' view before animating it into display, which produces a nasty jumpiness.

    A resolution seems to triggering a layout before performing the seemingly necessary animation to load visible cells.

        // Move the destination in place
        toVC.view.frame = [transitionContext finalFrameForViewController:toVC];
        // And kick it aside
        toVC.view.transform = CGAffineTransformMakeTranslation(delta, 0);
    
        [transitionContext containerView].backgroundColor = fromVC.view.backgroundColor;
    
        [[transitionContext containerView] layoutIfNeeded];
    
        // First step is required to trigger the load of the visible cells.
        [UIView animateWithDuration:0 delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{} completion:^(BOOL finished) {
    
    opened by markst 3
  • Transition between View Controllers issue

    Transition between View Controllers issue

    In my app, I have a couple of View Controllers each with a tableview as well as a HeaderView. the transition in the cells work well but the header views don't animate well. For example, both header views are visible during the transition before the initial header view animates out. This is not good.

    The reason I use a View Controller with subviews (tableview and header view) instead of a tableview controller is for ad banner support. The ads are difficult to control with the tableview controller.

    Any ideas on how I should handle the header view animations - I'd really like to use this library in my upcoming app. Thank you.

    opened by robmontesinos 3
  • UINavigationControllerOperationPop delta for fromVC

    UINavigationControllerOperationPop delta for fromVC

    I noticed on my pop animations, the cells of the fromVC were animating properly, however the superview was animating backwards (to the left), when it was supposed to be animating to the right.

    I finally narrowed down that on line 414, I was able to fix the issue by changing:

    [fromVC.view setTransform:CGAffineTransformMakeTranslation(delta, 0)];

    to:

    [fromVC.view setTransform:CGAffineTransformMakeTranslation(0, 0)];

    I'm not sure if that is a bug, or if it was intended to be that way, but with the change I made, the animation looks a lot cleaner.

    Can you let me know if I made a proper change, or if I potentially screwed something else up in doing this change?

    Thanks for the great work!

    opened by cohen72 2
  • Issues with translucent navigation bar

    Issues with translucent navigation bar

    The interactive pop gesture positions the visible cells wrong when using the translucent navigation bar. In my project the cells are being positioned where the navigation bar should be when the gesture is pending and when it completes they move to their correct positions, but in your Demo project they are also positioned at the wrong coordinates.

    Is there any quick fix for this?

    ios simulator screen shot 09 07 2014 02 56 39 ios simulator screen shot 09 07 2014 02 56 51 ios simulator screen shot 09 07 2014 02 56 59

    bug 
    opened by arturgrigor 2
  • Added some changes

    Added some changes

    Hey,

    I added some changes in my fork of your wonderful project

    https://github.com/voznesenskym/AMWaveTransition/compare/andreamazz:master...master

    I was hoping to do a bit of cleanup by removing some of the if-else ambiguity, and changed some defines to statics.

    I also gave the user the ability to access the transition style directly, which I thought could perhaps help this grow into something more expansive. If you want it to just stay a wave thats cool too.

    If you are interested let me know, and ill add my changes.

    Michael

    opened by voznesenskym 2
  • Auto-detect UITableView

    Auto-detect UITableView

    If the pushed or popped view controller is a UITableViewController (or has a tableView property), implementation of the protocol is not needed anymore. Especially if (section) header and footer views are involved, the implementation would get quite lengthy.

    Refactored the code (DRY).

    opened by futuretap 1
  • Is a transparent background of table view a must if this wave can work?

    Is a transparent background of table view a must if this wave can work?

    Your sample is great! I leverage it in my app, which looks good! Thank you!

    Tried non-transparent backgrounds of two UITableView, when transition, it looks weird. The background is moving slower than table view when back to the first level table view from the second level. Do you found that? Or, is anything wrong or I missed?

    question 
    opened by S1U 1
  • Multiple tableviews in one VC/Class

    Multiple tableviews in one VC/Class

    I have a view controller with two UITableViews, the VC is currently acting as the delegate/dataSource for both UITableViews. Is there any way to conditionally return the correct NSArray of visibleCells?

    I am aware the correct way to do it would be to have separate delegate/dataSource classes for the second UITableView but I want to know if it is possible without doing this? Thanks!

    opened by pranavt 1
  • Swift compatibility

    Swift compatibility

    Ciao Andrea!

    I was thinking about trying implement this on a swift project. Checking around , i wasn't able to get a swift version, or get if there s one. Is it possible integrate this into a swift project?

    PS Effetto pulito e molto bello

    opened by siideffect 3
  • Animation curve.

    Animation curve.

    It would be cool to be able to delay the pop or have an animation curve, kind of like this: https://dribbble.com/shots/1968347-GIF-for-the-ECHO-Feed-Dribbble-800x600?list=users&offset=1

    enhancement 
    opened by markst 1
  • Bug fixes, interactive alpha changing, fullscreen pan interactive transition

    Bug fixes, interactive alpha changing, fullscreen pan interactive transition

    -moved from Define to const -add viewControllers inset -add alpha changing for interactive transition -fixed bug with 0 index in interactive transition -add fullscreen pan interactive transition -interactive transition working without visible cells as plain transition -fixed bug with wrong transition when visible cells count = 0 -refactor handlePan method

    There is one bug when pop fourth vc to third with interactive transition - table view header 'y' gets wrong, but after transition complete header gets into right position. In my projects transition works properly, and i don't know how to fix this bug in demo. Take a look.

    Sorry for my english.

    opened by Sashke 1
Releases(0.6.2)
Owner
Andrea Mazzini
💻 Software Engineer 🌲 Woodworker
Andrea Mazzini
A PageView, which supporting scrolling to transition between a UIView and a UITableView

YXTPageView ##A Page View, which support scrolling to transition between a UIView and a UITableView UIView (at the top) UITableView (at the bottom) In

Hanton Yang 68 May 25, 2022
Custom-Transition - A repo about custom transition between two view controllers

Custom-Transition in SWIFT This is a repo about custom transition between two vi

Prakash Chandra Awal 0 Jan 6, 2022
SwipeViewController is a Swift modification of RKSwipeBetweenViewControllers - navigate between pages / ViewControllers

SwipeViewController What is SwipeViewController? SwipeViewController enables you to modify the navigation bar and implement 'Swipe Buttons' that can u

Marek Fořt 657 Dec 6, 2022
PassValuesBetweenViewControllers - Pass Values Between ViewControllers

PassValuesBetweenViewControllers Vista creada con: Programmatic + AutoLayout Bre

Vanesa Giselle Korbenfeld 0 Jan 18, 2022
A Swift mixin for reusing views easily and in a type-safe way (UITableViewCells, UICollectionViewCells, custom UIViews, ViewControllers, Storyboards…)

Reusable A Swift mixin to use UITableViewCells, UICollectionViewCells and UIViewControllers in a type-safe way, without the need to manipulate their S

Olivier Halligon 2.9k Jan 3, 2023
SPLarkController - Custom transition between controllers. Settings controller for your iOS app.

SPLarkController About Transition between controllers to top. You can change animatable height after presentation controller. For presentation and dis

Ivan Vorobei 965 Dec 17, 2022
Custom transition between controllers. Settings controller for your iOS app.

SPLarkController About Transition between controllers to top. You can change animatable height after presentation controller. For presentation and dis

Ivan Vorobei 965 Dec 17, 2022
Custom transition between two collection view layouts

Display Switcher We designed a UI that allows users to switch between list and grid views on the fly and choose the most convenient display type. List

Yalantis 2.3k Dec 14, 2022
ListPlaceholder is a swift library allows you to easily add facebook style animated loading placeholder to your tableviews or collection views.

ListPlaceholder ListPlaceholder Facebook news feed style animation Features ListPlaceholder is a swift library allows you to easily add facebook style

Moayad Al Kouz 628 Dec 19, 2022
TableViews - Emoji Table View For iOS With Swift

TableViews Hello! This is EmojiTableView. Let me introduce you my first app when

null 0 Jan 2, 2022
Flash-Chat - Firebase Cloud Firestore, TableViews and Cocoapod Dependencies

Flash-Chat Firebase Cloud Firestore, TableViews and Cocoapod Dependencies What I

null 0 Jan 19, 2022
Appstore card animation transition. UICollectionView and UITableView card expand animated transition

Appstore card animation transition. UICollectionView and UITableView card expand animated transition. This library tries to add the appstore transition to your own app. The goal is to be as simple as possible to integrate in an app while keeping the flexibility and customization alive.

appssemble 544 Dec 28, 2022
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.

DTPagerController This is a control for iOS written in Swift. DTPagerController is simple to use and easy to customize. Screenshots Default segmented

Tung Vo 290 Nov 13, 2022
A fully customizable container view controller to display a set of ViewControllers in a horizontal scroll view. Written in Swift.

DTPagerController This is a control for iOS written in Swift. DTPagerController is simple to use and easy to customize. Screenshots Default segmented

Tung Vo 290 Nov 13, 2022
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

Zhouqi Mo 3.3k Dec 21, 2022
Cool wave like transition between two or more UICollectionView

CKWaveCollectionViewTransition This is a cool custom transition between two or more UICollectionViewControllers with wave-like cell animation. Could b

Cezary Kopacz 1.9k Oct 4, 2022
A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles

A drop-in universal library helps you to manage the navigation bar styles and makes transition animations smooth between different navigation bar styles while pushing or popping a view controller for all orientations. And you don't need to write any line of code for it, it all happens automatically.

Zhouqi Mo 3.3k Dec 21, 2022
A PageView, which supporting scrolling to transition between a UIView and a UITableView

YXTPageView ##A Page View, which support scrolling to transition between a UIView and a UITableView UIView (at the top) UITableView (at the bottom) In

Hanton Yang 68 May 25, 2022
Create a smooth transition between any two SwiftUI Views

GZMatchedTransformEffect Create a smooth transition between any two SwiftUI Views. It is very similar to the built-in .matchedGeometryEffect() modifie

Gong Zhang 10 Nov 26, 2022
iOS framework for impressive transition animations between views.

CoreTransition iOS framework for impressive transition animations between views. Built using Swift, and supports a lot of animations to navigate to a

Ahmed Abdelkarim 4 Nov 17, 2022