【发布时间】:2016-11-09 14:12:34
【问题描述】:
我是 swift 新手。我有一个带有一个自定义 UITableViewCell 的 UITableView。它有一个 UITextfield。默认 numberOfRows 为 1。
当我在该文本字段中输入一个整数值 (x) 并按 Enter 键时,表格视图应附加 x 个表格视图单元格,并且每个单元格都应有一个文本字段。
这是我的代码:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell : TableViewCell = self.tableView.dequeueReusableCellWithIdentifier("Cell") as! TableViewCell
cell.textField?.text = "Created"
cell.textField.tag = indexPath.row
cell.textField.addTarget(self, action: #selector(textFieldShouldReturn()), forControlEvents: <#T##UIControlEvents#>)
return cell
}
【问题讨论】:
-
我不清楚你要什么。 “输入n个值”和“增加n倍”是什么意思?
标签: ios swift uitableview uitextfield