From 306d1ac4d8c92213a729383b0cc3b2e3dd004d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Coye=20de=20Brune=CC=81lis?= Date: Wed, 12 Feb 2025 14:03:18 +0100 Subject: [PATCH] feat(ParameterTableViewController): Custom design table view section --- .../Menu/ParameterTableViewController.swift | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/kDrive/UI/Controller/Menu/ParameterTableViewController.swift b/kDrive/UI/Controller/Menu/ParameterTableViewController.swift index 7d3b563ff..0959f0bff 100644 --- a/kDrive/UI/Controller/Menu/ParameterTableViewController.swift +++ b/kDrive/UI/Controller/Menu/ParameterTableViewController.swift @@ -150,10 +150,30 @@ class ParameterTableViewController: BaseGroupedTableViewController { } override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { - guard let currentSection = ParameterSection(rawValue: section) else { - return nil - } - return currentSection.title(packId: packId) + return nil + } + + override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + guard let currentSection = ParameterSection(rawValue: section) else { return nil } + + let headerView = UIView() + headerView.backgroundColor = .clear + + let label = IKLabel() + label.text = currentSection.title(packId: packId) + label.font = TextStyle.body1.font + label.textColor = KDriveResourcesAsset.titleColor.color + + label.translatesAutoresizingMaskIntoConstraints = false + headerView.addSubview(label) + + NSLayoutConstraint.activate([ + label.leadingAnchor.constraint(equalTo: headerView.leadingAnchor, constant: 24), + label.trailingAnchor.constraint(equalTo: headerView.trailingAnchor, constant: -24), + label.centerYAnchor.constraint(equalTo: headerView.centerYAnchor) + ]) + + return headerView } override func numberOfSections(in tableView: UITableView) -> Int {