Вы можете создать customView для вашего заголовка с помощью этого метода: я сделал примерное представление для вас, чтобы настроить его.
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let headerView = UIView()
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.textColor = UIColor.white
label.numberOfLines = 0
label.textAlignment = .center
label.font = .boldSystemFont(ofSize: 20)
headerView.addSubview (questionLabel)
headerView.backgroundColor = .blue
NSLayoutConstraint.activate([
questionLabel.centerYAnchor.constraint(equalTo: headerView.centerYAnchor, constant: 0),
questionLabel.leadingAnchor.constraint(equalTo: headerView.leadingAnchor, constant: 0),
questionLabel.trailingAnchor.constraint(equalTo: headerView.trailingAnchor, constant: 0)
])
return headerView
}