-1
當我按下特定單元格按鈕時,我在textView單元格中編輯了文本框和編輯按鈕,顯示光標和按鈕圖像已更改,並且我在此處調用了api。如果我再次單擊按鈕光標不顯示在文本字段中。如何在tableview單元格文本框中顯示光標
當我按下特定單元格按鈕時,我在textView單元格中編輯了文本框和編輯按鈕,顯示光標和按鈕圖像已更改,並且我在此處調用了api。如果我再次單擊按鈕光標不顯示在文本字段中。如何在tableview單元格文本框中顯示光標
試試這個:將標籤分配給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];
}
我把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的 –
更新代碼 –
你好,特定的細胞文本框光標快到了,我想只有一個按鈕的圖像將被突出顯示,這裏所有的按鈕圖像強調,只有在一次單一的按鈕圖像和光標將突出顯示。 –