Reputation: 932
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==0) {
//Edit the textView in this cell
}
Is there a way to do this? How?
Upvotes: 0
Views: 216
Reputation: 2026
If you have added textview as a subview to cells contenview then you can try this
{
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
for(int i=0;i<[[cell.contentView subviews] count];i++)
{
if([[[cell.contentView subviews] objectAtIndex:i] isKindOfClass:[UITextView class]])
{
[[[cell.contentView subviews] objectAtIndex:i] becomeFirstResponder];
}
}
}
Upvotes: 1
Reputation: 1294
For example, you have a custom UITableViewCell with the
@property (nonatomic, retain) UITextView* textView;
so, to appear the keyboard
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==0) {
[tableView cellForRowAtIndexPath:indexPath]textView]becomeFirstResponder];
}
}
Upvotes: 2