2016-02-12 89 views

回答

0

试试这个:将标签分配给IndexPath中行的单元格中的编辑按钮。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 
     cell.editButton.tag = indexpath.row; 
} 

获取参考到您的位置基于其indexpath。将其文本字段设置为第一个响应者。

- (IBAction)editButtonClicked:(id)sender{ 
     UIButton *button = (UIButton*)sender; 
     NSIndexPath *indexPath = [NSIndexPath indexPathForItem:button.tag inSection:0]; 
     CustomCell *cell = (CustomCell*)[tableView cellForRowAtIndexPath:indexPath]; 
     [cell.yourTextField becomeFirstResponder]; 

} 
+0

我把textfield硬编码在表格单元格中[cell.yourTextField becomeFirstResponder];这个属性如何添加,我添加像这样,但不是确切的UIButton * button1 =(UIButton *)sender; NSIndexPath * indexPath1 = [NSIndexPath indexPathForItem:button1.tag inSection:0]; 的UITableViewCell *细胞=(的UITableViewCell *)[tableView_EditCategory的cellForRowAtIndexPath:indexPath1]; [cell.contentView addSubview:txtFld_EmailEditCategory]; [txtFld_EmailEditCategory becomeFirstResponder];在你的问题你的cellForRowAtIndexPath的 –

+0

更新代码 –

+0

你好,特定的细胞文本框光标快到了,我想只有一个按钮的图像将被突出显示,这里所有的按钮图像强调,只有在一次单一的按钮图像和光标将突出显示。 –