我會做這樣的事情https://i.stack.imgur.com/jAGsk.png保存文本框的值單元格爲textLabel(名稱)SWIFT]
因此,如果用戶輸入點 - 它會點保存到用戶的姓名。怎麼做?我用一個函數將textField粘貼到tableViewCell中。 下面是從tableViewCell代碼文件
@IBOutlet weak var inputScore: UITextField!
public func configure(text: Int?, placeholder: String) {
inputScore.text = String(text!)
inputScore.placeholder = placeholder
inputScore.accessibilityValue = String(text!)
inputScore.accessibilityLabel = placeholder
}
這裏是代碼從VC文件
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "InputScore") as! InputScoreTableViewCell
cell.textLabel?.text = usersIn[indexPath.row]
cell.configure(text: 100, placeholder: "Score")
return cell
}
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return usersIn.count
}
那麼如何將其保存到用戶的姓名?
看看這個解決方案:https://stackoverflow.com/a/42159435/4488252 –
@GOODDUDE SO是一個社區,有些人只是爲了解決其他人的問題而解決一些問題幫助人們作爲感謝的證明,請表示感謝您解答您的答案 –