A common way to dismiss a modal is to swipe down - How do we allows the user to drag the modal down, if it\'s far enough, the modal\'s dismissed, otherwise it animates back
created a demo for interactively dragging down to dismiss view controller like snapchat's discover mode. Check this github for sample project.
In Objective C : Here's the code
inviewDidLoad
UISwipeGestureRecognizer *swipeRecognizer = [[UISwipeGestureRecognizer alloc]
initWithTarget:self action:@selector(swipeDown:)];
swipeRecognizer.direction = UISwipeGestureRecognizerDirectionDown;
[self.view addGestureRecognizer:swipeRecognizer];
//Swipe Down Method
- (void)swipeDown:(UIGestureRecognizer *)sender{
[self dismissViewControllerAnimated:YES completion:nil];
}
I've created an easy to use extension.
Just inherent Your UIViewController with InteractiveViewController and you are done InteractiveViewController
call method showInteractive() from your controller to show as Interactive.