表视图中的节名称

Mer*_*kus 2 textfield tableview sections swift

如何获取文本字段的文本,并将其作为tableview中某个部分的名称?我想在Swift和Xcode 6中做到这一点.非常感谢.

Chr*_*örz 7

你可以用titleForHeaderInSection.

func tableView(tableView: UITableView!, titleForHeaderInSection section: Int) -> String!{
        if (section == 0){
            return textfield.text
        }
        if (section == 1){
            return textfield2.text
        }
    }
Run Code Online (Sandbox Code Playgroud)