好的,我找到了解决方案。
我覆盖了 didSlectRowAtIndexPath 方法。
import UIKit
class SettingsViewController: IASKAppSettingsViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.backgroundColor = .black
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = super.tableView(tableView, cellForRowAt: indexPath)
cell.backgroundColor = .clear
cell.textLabel?.textColor = .white
cell.selectionStyle = .none
return cell
}
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//Creating specifier object
let specifier = self.settingsReader.specifier(for: indexPath)
//Creating a custom IASKSpecifierValuesViewController instance
let targetViewController = SettingsDetail(style: .grouped)
targetViewController.currentSpecifier = specifier
targetViewController.settingsStore = settingsStore
targetViewController.settingsReader = settingsReader
self.navigationController?.pushViewController(targetViewController, animated: true)
}
}
详细视图源代码:
import UIKit
class SettingsDetail: IASKSpecifierValuesViewController {
override func viewDidLoad() {
super.viewDidLoad()
self.tableView.backgroundColor = .black
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = super.tableView(tableView, cellForRowAt: indexPath)
cell.backgroundColor = .clear
cell.textLabel?.textColor = .white
cell.selectionStyle = .none
return cell
}
}