only prepare saveAddPasswordSegue

This commit is contained in:
Bob Sun 2017-02-11 16:12:10 +08:00
parent a3cbed9a21
commit 3cec9643e5
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
2 changed files with 7 additions and 5 deletions

View file

@ -648,7 +648,7 @@
</barButtonItem>
<barButtonItem key="rightBarButtonItem" systemItem="save" id="FtF-nT-zRJ">
<connections>
<segue destination="rRf-7l-IGe" kind="unwind" unwindAction="saveAddPasswordWithSegue:" id="eVU-Kz-JU0"/>
<segue destination="rRf-7l-IGe" kind="unwind" identifier="saveAddPasswordSegue" unwindAction="saveAddPasswordWithSegue:" id="eVU-Kz-JU0"/>
</connections>
</barButtonItem>
</navigationItem>

View file

@ -40,10 +40,12 @@ class AddPasswordTableViewController: UITableViewController {
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let nameCell = getCellForName(name: "name")! as! TextFieldTableViewCell
let passwordCell = getCellForName(name: "password")! as! TextFieldTableViewCell
let additionsCell = getCellForName(name: "additions")! as! TextViewTableViewCell
password = Password(name: nameCell.contentTextField.text!, plainText: "\(passwordCell.contentTextField.text!)\n\(additionsCell.contentTextView.text!)")
if segue.identifier == "saveAddPasswordSegue" {
let nameCell = getCellForName(name: "name")! as! TextFieldTableViewCell
let passwordCell = getCellForName(name: "password")! as! TextFieldTableViewCell
let additionsCell = getCellForName(name: "additions")! as! TextViewTableViewCell
password = Password(name: nameCell.contentTextField.text!, plainText: "\(passwordCell.contentTextField.text!)\n\(additionsCell.contentTextView.text!)")
}
}
func getCellAt(row: Int) -> UITableViewCell? {