【发布时间】:2016-11-23 12:13:38
【问题描述】:
正如标题所述,我在UITableViewCell 中有一个UITextField。
我的 tableView 列出了一个名为 tallies: [String] 的数组中的项目
我在点击按钮时插入一个新条目,并在新单元格中制作动画。一旦rowAnimation 完成,我想要titleTextField 到becomeFirstResponder,但到目前为止还不能让它工作。
新行动画完美,但 titleTextField 不会 becomeFirstResponder
这是我尝试过的:
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()
【问题讨论】:
标签: ios swift uitableview uitextfield becomefirstresponder