CocoaPods trunk is moving to be read-only. Read more on the blog, there are 19 months to go.
TestsTested | β |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2016 |
Maintained by talisk.
English | δΈζη
An elegant way to handle pop gesture recogenizer event.
Have you ever had such a problem?
leftNavigationItem
.Now you can implement them with a little bit of code.
AppDelegate.m
#import "AppDelegate.h"
#import "PopEvent.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[PopEvent restorePopGestureRecognizer];
return YES;
}
@end
ViewController1.m
#import "ViewController1.h"
#import "PopEvent.h"
@implementation ViewController1
- (void)viewDidLoad {
[super viewDidLoad];
[self addPopEventSelectorString:@"popEvent" viewControllerNamed:NSStringFromClass([self class])];
}
- (void)popEvent {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"PopEvent!" message:@"do something" preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
Drag the PopEvent
folder to your project.
PopEvent has two functions. First, #import "PopEvent.h"
.
Add only one line of code into -application: didFinishLaunchingWithOptions:
in AppDelegate
.
Make sure the code runs before the RootViewController's initialization when your app isn't loaded from storyboard.
[PopEvent restorePopGestureRecognizer];
Add only one line of code into the ViewController which will be prevented the pop gesture recognizer.
[self addPopEventSelectorString:@"popEvent" viewControllerNamed:NSStringFromClass([self class])];
The first parameter need to be replaced by the event function name.
You can find detail in the Example.
Welcome to send email to me, or open issue on the repository.
The project follow to the MIT license. Welcome contributions.