BubbleTransition with Objective-C
March 26, 2018 ยท View on GitHub
// BubbleTransition imported as a pod with Cocoapods: // // pod 'BubbleTransition' // use_frameworks! //
#import "ViewController.h" @import BubbleTransition;
@interface ViewController ()
@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
)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
)animationControllerForDismissedController:(UIViewController *)dismissed { self.transition.transitionMode = BubbleTransitionModeDismiss; self.transition.startingPoint = self.button.center; self.transition.bubbleColor = [UIColor grayColor]; return self.transition; }
@end