Skip to content

Instantly share code, notes, and snippets.

@naotokui
Created January 31, 2012 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naotokui/1709648 to your computer and use it in GitHub Desktop.
Save naotokui/1709648 to your computer and use it in GitHub Desktop.
- (UIView *)findFirstResponder
- (UIView *) findFirstResonder:(UIView*)root
{
if ([root isFirstResponder]) {
return root;
}
for (UIView *subView in root.subviews) {
UIView *firstResponder = [self findFirstResonder:subView];
if (firstResponder != nil) {
return firstResponder;
}
}
return nil;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment