UITableviewCell
を使用してアプリケーションプロジェクトでプロファイルフォームを作成しています。だから私は単一の細胞を使用しています。カスタムセルはUITextField
で構成されています。最初に、これらのフィールドにはWebサービスが設定されます。以下に示すようにスクロールアップとスクロールダウン中にカスタムテーブルビューのセルのUITextFieldの値が変更される
今、私は完全な名前を編集することができます。
あなたは、私は完全な名前フィールドにラウルを入力した見ることができます。
テーブルビューを上にスクロールして下にスクロールすると、変更された値が失われ、最初のテキストフィールドに古いエントリが表示されます。
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// create a new cell if needed or reuse an old one
let regCell = profileManagement.dequeueReusableCell(withIdentifier:"regFirstCell", for: indexPath)as? RegistrationFieldTableViewCell
regCell?.registrationField.tag = indexPath.row
regCell?.registrationFieldImage.image = fieldImages[indexPath.row]
let nameFields = NSLocalizedString(regFieldsNames[indexPath.row], comment: "")
regCell?.registrationField.placeholder = nameFields
regCell?.registrationField.autocorrectionType = .no
regCell?.registrationField.keyboardType = UIKeyboardType.default
regCell?.showPassword.isHidden = true
//Swith case for giving keypad to textfields
switch indexPath.row {
case 0:
regCell?.registrationField.text = self.name
case 1:
regCell?.registrationField.text = self.emailId
case 2:
regCell?.registrationField.text = self.civilId
regCell?.registrationField.isUserInteractionEnabled = false
case 3:
regCell?.registrationField.text = self.phoneNumber
regCell?.registrationField.isUserInteractionEnabled = false
case 4:
regCell?.registrationField.isSecureTextEntry = true
regCell?.registrationField.text = "abhijith123"
regCell?.showPassword.isHidden = true
regCell?.registrationField.isUserInteractionEnabled = false
default:
print("Something else")
}
return regCell!
}
新しい値を入力すると、その値を保存するためにどのようなコードを使用しますか? –
現在、私は新しい値を格納するコードを使用していません。この方法を提案してください –