Skip to content

Instantly share code, notes, and snippets.

@obyknovenius
Created October 12, 2015 15:27
Show Gist options
  • Save obyknovenius/2b7d3a1166397626376e to your computer and use it in GitHub Desktop.
Save obyknovenius/2b7d3a1166397626376e to your computer and use it in GitHub Desktop.
#import "UIResponder+FirstResponder.h"
static __weak id currentFirstResponder;
@implementation UIResponder (FirstResponder)
+ (id)currentFirstResponder
{
currentFirstResponder = nil;
[[UIApplication sharedApplication] sendAction:@selector(findFirstResponder:) to:nil from:nil forEvent:nil];
return currentFirstResponder;
}
- (void)findFirstResponder:(id)sender
{
currentFirstResponder = self;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment