Skip to content

Commit

Permalink
feat(ParameterTableViewController): Custom design table view section
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-coye committed Feb 12, 2025
1 parent fda3c30 commit 306d1ac
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions kDrive/UI/Controller/Menu/ParameterTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 306d1ac

Please sign in to comment.