Created
February 14, 2014 02:09
-
-
Save alanthonyc/8994620 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation UIView (FindFirstResponder) | |
- (id)findFirstResponder | |
{ | |
if (self.isFirstResponder) { | |
return self; | |
} | |
for (UIView *subView in self.subviews) { | |
id responder = [subView findFirstResponder]; | |
if (responder) return responder; | |
} | |
return nil; | |
} | |
@end | |
// Or... | |
UIView *firstResponder; | |
for (UIView *view in self.view.subviews) //: caused error | |
{ | |
if (view.isFirstResponder) | |
{ | |
firstResponder = view; | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From SO