Skip to content

Let any modally presented view be able to be dismissed by touching outside of it.

License

Notifications You must be signed in to change notification settings

DavydLiu/UIViewController-Dismissible

Repository files navigation

UIViewController+Dismissible

Version License Platform

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

To use this Pod, add and remove touchBehind gesture recognizer as follow:

#import "UIViewController+Dismissible.h"

- (void)viewDidAppear:(BOOL)animated
{
	[super viewDidAppear:animated];
	
	// add gesture recognizer to UIWindow
	[self.view.window addGestureRecognizer:self.tapBehindGesture];
}

- (void)viewWillDisappear:(BOOL)animated
{
	[super viewWillDisappear:animated];

	// remove gesture recognizer from UIWindow
	[self.view.window removeGestureRecognizer:self.tapBehindGesture];
}

Requirements

ARC

Installation

UIViewController+Dismissible is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "UIViewController+Dismissible"

Author

Xingruo Liu, [email protected]

License

UIViewController+Dismissible is available under the MIT license. See the LICENSE file for more info.

About

Let any modally presented view be able to be dismissed by touching outside of it.

Resources

License

Stars

Watchers

Forks

Packages

No packages published