add additional field example in the footer of addition cell
This commit is contained in:
parent
e40cadaec1
commit
2829e9145d
2 changed files with 9 additions and 4 deletions
|
|
@ -19,6 +19,8 @@ class EditPasswordTableViewController: PasswordEditorTableViewController {
|
||||||
[[.type: PasswordEditorCellType.textViewCell, .title: "additions", .content: password!.getAdditionsPlainText()]],
|
[[.type: PasswordEditorCellType.textViewCell, .title: "additions", .content: password!.getAdditionsPlainText()]],
|
||||||
]
|
]
|
||||||
sectionHeaderTitles = ["name", "password", "additions"].map {$0.uppercased()}
|
sectionHeaderTitles = ["name", "password", "additions"].map {$0.uppercased()}
|
||||||
|
sectionFooterTitles = ["", "", "It is recommended to use \"key: value\" format to store additional fields as follows:\n url: https://www.apple.com\n username: passforios@gmail.com."]
|
||||||
|
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ class PasswordEditorTableViewController: UITableViewController {
|
||||||
[Dictionary<PasswordEditorCellKey, Any>]
|
[Dictionary<PasswordEditorCellKey, Any>]
|
||||||
]()
|
]()
|
||||||
var sectionHeaderTitles = [String]()
|
var sectionHeaderTitles = [String]()
|
||||||
|
var sectionFooterTitles = [String]()
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
@ -33,6 +34,8 @@ class PasswordEditorTableViewController: UITableViewController {
|
||||||
tableView.rowHeight = UITableViewAutomaticDimension
|
tableView.rowHeight = UITableViewAutomaticDimension
|
||||||
tableView.estimatedRowHeight = 48
|
tableView.estimatedRowHeight = 48
|
||||||
tableView.allowsSelection = false
|
tableView.allowsSelection = false
|
||||||
|
self.tableView.sectionFooterHeight = UITableViewAutomaticDimension;
|
||||||
|
self.tableView.estimatedSectionFooterHeight = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||||
|
|
@ -57,10 +60,6 @@ class PasswordEditorTableViewController: UITableViewController {
|
||||||
return 44
|
return 44
|
||||||
}
|
}
|
||||||
|
|
||||||
override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
|
|
||||||
return 0.1
|
|
||||||
}
|
|
||||||
|
|
||||||
override func numberOfSections(in tableView: UITableView) -> Int {
|
override func numberOfSections(in tableView: UITableView) -> Int {
|
||||||
return tableData.count
|
return tableData.count
|
||||||
}
|
}
|
||||||
|
|
@ -73,5 +72,9 @@ class PasswordEditorTableViewController: UITableViewController {
|
||||||
return sectionHeaderTitles[section]
|
return sectionHeaderTitles[section]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func tableView(_ tableView: UITableView, titleForFooterInSection section: Int) -> String? {
|
||||||
|
return sectionFooterTitles[section]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue