2016-02-12 73 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

你好,特定的細胞文本框光標快到了,我想只有一個按鈕的圖像將被突出顯示,這裏所有的按鈕圖像強調,只有在一次單一的按鈕圖像和光標將突出顯示。 –

相關問題