Skip to content

Instantly share code, notes, and snippets.

@samrayner
Last active October 13, 2015 18:58
Show Gist options
  • Save samrayner/4241607 to your computer and use it in GitHub Desktop.
Save samrayner/4241607 to your computer and use it in GitHub Desktop.
Select first UITextField or UITextView of a UITableViewCell
- (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