Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

commented Jul 6, 2015

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

@RZR666

This comment has been minimized.

Copy link

commented Jan 13, 2016

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

@0xhex

This comment has been minimized.

Copy link

commented Oct 24, 2017

can this be used with a push navigation controler?

@pessionic

This comment has been minimized.

Copy link

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
You can’t perform that action at this time.