タイトルが示すように、UITableViewCell
の中にUITextField
があります。UITableViewCellのUITextFieldは、挿入後にfirstFirstResponderになります
私のtableViewがtallies: [String]
と呼ばれる配列のアイテムIは、ボタンタップで新しいエントリを挿入し、新しいセルにアニメーションだが一覧表示されます。私は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
それも試してみました。 no luck – Leon