1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- //
- // SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
- // SPDX-License-Identifier: GPL-3.0-or-later
- //
- class SimpleTableViewController: UITableViewController {
- let options: [String]
- let navigationTitle: String
- init(withOptions options: [String], withTitle title: String) {
- self.options = options
- self.navigationTitle = title
- super.init(style: .insetGrouped)
- }
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- override func viewDidLoad() {
- super.viewDidLoad()
- self.navigationController?.navigationBar.isTranslucent = false
- self.navigationItem.title = navigationTitle
- self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: NCAppBranding.themeTextColor()]
- self.navigationController?.navigationBar.tintColor = NCAppBranding.themeTextColor()
- self.navigationController?.navigationBar.barTintColor = NCAppBranding.themeColor()
- self.tabBarController?.tabBar.tintColor = NCAppBranding.themeColor()
- let themeColor: UIColor = NCAppBranding.themeColor()
- let appearance = UINavigationBarAppearance()
- appearance.configureWithOpaqueBackground()
- appearance.backgroundColor = themeColor
- appearance.titleTextAttributes = [.foregroundColor: NCAppBranding.themeTextColor()]
- self.navigationItem.standardAppearance = appearance
- self.navigationItem.compactAppearance = appearance
- self.navigationItem.scrollEdgeAppearance = appearance
- }
- // MARK: Table view data source
- override func numberOfSections(in tableView: UITableView) -> Int {
- return 1
- }
- override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return options.count
- }
- override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = UITableViewCell(style: .default, reuseIdentifier: "SimpleTableViewCell")
- cell.textLabel?.text = options[indexPath.row]
- cell.selectionStyle = .none
- return cell
- }
- }
|