Customize header in UITableView
<p>I'm trying to customize header in section in UITableView. I couldn't find to do it in storyboard so I started adding UIView and UILabel.</p>

<p>Here is my code:</p>

<pre><code>func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -&gt; UIView? {
    let headerView = UIView(frame: CGRectMake(0,0, tableView.frame.size.width, 60))
    headerView.backgroundColor = UIColor.cyanColor()
    headerView.layer.borderColor = UIColor.whiteColor().CGColor
    headerView.layer.borderWidth = 1.0;

    let headerLabel = UILabel(frame: CGRectMake(5,2, tableView.frame.size.width - 5, 30))
    headerLabel.text = sectionTitle  (this is a variable)
    headerLabel.textAlignment = NSTextAlignment.Center
    headerLabel.font = UIFont(name: "AvenirNext", size: 18)
    headerLabel.textAlignment = NSTextAlignment.Center;
    headerView.addSubview(headerLabel)

    return headerView
    }

func tableView(tableView: UITableView, heightForHeaderInSection section: Int) -&gt; CGFloat {
        return 60
    }
</code></pre>

<p>It makes a view like below:
<a href="https://i.stack.imgur.com/KodV7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/KodV7.png" alt="enter image description here"></a></p>

<p>I am looking for a way to locate UILabel vertically and horizontally center of the view. How would I do that? Would it always change whenever I change the font and size?</p>

<p>Also, would there by anyway I can do this in storyboard? It is really hard to make header programmatically.</p>