正如標題所述,我在UITableViewCell
中有UITextField
。UITableViewCell中的UITextField在插入後成爲第一個響應者
我的tableView列出一個數組項稱爲tallies: [String]
我插入按鈕水龍頭一個新條目,並在新的小區動畫。我想titleTextField
到becomeFirstResponder
一旦rowAnimation
已完成,但到目前爲止無法使其工作。行插入後
CATransaction.begin()
CATransaction.setCompletionBlock {
let cell = self.tableView(self.tableView, cellForRowAtIndexPath: self.editingIndexPath!) as! TallyCell
cell.titleTextField.hidden = false
cell.titleTextField.becomeFirstResponder()
}
tableView.beginUpdates()
tallies.append("Example")
tableView.insertRowsAtIndexPaths([editingIndexPath!], withRowAnimation: .Left)
tableView.endUpdates()
CATransaction.commit()
對不起,我應該說,它似乎停止行動畫,如果我 – Leon
後直接把它刪除CTTransaction和做類似[的tableView insertRowsAtIndexPaths:@ [indexPath] withRowAnimation: UITableViewRowAnimationLeft]; [cell.textLabel becomeFirstResponder]; – jagdish
也試過了。沒有運氣 – Leon