在运行App时编辑单元格时更新阵列

时间:2015-09-19 15:07:37

标签: ios arrays xcode swift uitableview

我在ViewController&中找到了tableView。一个名为toDo的数组,在TableView中我是一个单元格,在单元格中我得到了textView。 textView是可编辑的(用户可以更改textView中的文本)。 用户更改文本后 - 我希望单元格将其保存到toDo数组,但每当我重新加载数据时,文本都会消失。 这是我试过的:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell: TableViewCell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath:indexPath) as! TableViewCell
        cell.textField.text = toDo[indexPath.row]
        cell.textField.delegate = self
        return cell
    }

**我有一个测试按钮,每当我点击它重新加载数据。

0 个答案:

没有答案
相关问题