Last active
October 13, 2015 18:58
-
-
Save samrayner/4241607 to your computer and use it in GitHub Desktop.
Select first UITextField or UITextView of a UITableViewCell
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
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; | |
NSArray *subviews = [cell.contentView subviews]; | |
for(UIView *subview in subviews) { | |
if([subview isKindOfClass:[UITextField class]] || [subview isKindOfClass:[UITextView class]]) { | |
[subview becomeFirstResponder]; | |
break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment