remove hardcoded index path of setting cell

This commit is contained in:
Bob Sun 2017-02-25 11:40:12 +08:00
parent c6db44ace7
commit 0f975882ee
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4

View file

@ -18,16 +18,18 @@ class GeneralSettingsTableViewController: BasicStaticTableViewController {
tableData = [
// section 0
[[.title: "About Repository", .action: "segue", .link: "showAboutRepositorySegue"],],
// section 1
[[.title: "Hide Unknown Fields", .action: "none",],],
]
super.viewDidLoad()
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = super.tableView(tableView, cellForRowAt: indexPath)
if indexPath == IndexPath(row: 0, section: 1) {
if cell.textLabel?.text == "Hide Unknown Fields" {
cell.accessoryType = .none
hideUnknownSwitch.onTintColor = UIColor(displayP3Red: 0, green: 122.0/255, blue: 1, alpha: 1)
hideUnknownSwitch.sizeToFit()