Last active
March 26, 2018 07:29
-
-
Save andreamazz/9b0d6c7db065555ec0d7 to your computer and use it in GitHub Desktop.
BubbleTransition with Objective-C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
Seconded, can this transition be used with a push segue?
can this be used with a push navigation controler?
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
Hi! How to I can use bubble transition with push segue?