Skip to content

Instantly share code, notes, and snippets.

@andreamazz
Last active March 26, 2018 07:29
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreamazz/9b0d6c7db065555ec0d7 to your computer and use it in GitHub Desktop.
Save andreamazz/9b0d6c7db065555ec0d7 to your computer and use it in GitHub Desktop.
BubbleTransition with Objective-C
// BubbleTransition imported as a pod with Cocoapods:
//
// pod 'BubbleTransition'
// use_frameworks!
//
#import "ViewController.h"
@import BubbleTransition;
@interface ViewController () <UIViewControllerTransitioningDelegate>
@property (weak, nonatomic) IBOutlet UIButton *button;
@property (strong, nonatomic) BubbleTransition *transition;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.transition = [[BubbleTransition alloc] init];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
UIViewController *controller = segue.destinationViewController;
controller.transitioningDelegate = self;
controller.modalPresentationStyle = UIModalPresentationCustom;
}
- (id <UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source {
self.transition.transitionMode = BubbleTransitionModePresent;
self.transition.startingPoint = self.button.center;
self.transition.bubbleColor = [UIColor grayColor];
return self.transition;
}
- (id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
self.transition.transitionMode = BubbleTransitionModeDismiss;
self.transition.startingPoint = self.button.center;
self.transition.bubbleColor = [UIColor grayColor];
return self.transition;
}
@end
@tonygosol
Copy link

Hi! How to I can use bubble transition with push segue?

@RZR666
Copy link

RZR666 commented Jan 13, 2016

Seconded, can this transition be used with a push segue?

@0xhex
Copy link

0xhex commented Oct 24, 2017

can this be used with a push navigation controler?

@pessionic
Copy link

pessionic commented Dec 3, 2017

In prepareForSegue this line:
controller.modalTransitionStyle = UIModalPresentationCustom;
should be replaced by
controller.modalPresentationStyle = UIModalPresentationCustom;
Otherwise, the dismiss transition vanishes to a black screen before showing the presenting view controller. This was pointed out in issue #12: andreamazz/BubbleTransition#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment