-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSectionHeaderView.swift
More file actions
37 lines (33 loc) · 1.24 KB
/
SectionHeaderView.swift
File metadata and controls
37 lines (33 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
// SectionHeaderView.swift
// NoteSwap
//
// Created by Nick Dugal on 4/19/16.
// Copyright © 2016 Nick Dugal. All rights reserved.
//
import UIKit
class SectionHeaderView: UICollectionReusableView {
var titleLabel: UILabel?
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
self.setupSubviews()
self.autolayoutSubviews()
}
override init(frame: CGRect) {
super.init(frame: frame)
self.setupSubviews()
self.autolayoutSubviews()
}
func setupSubviews() {
self.titleLabel = UILabel()
self.titleLabel!.translatesAutoresizingMaskIntoConstraints = false
self.titleLabel!.font = UIFont.systemFontOfSize(24.0)
self.addSubview(self.titleLabel!)
}
func autolayoutSubviews() {
self.titleLabel!.topAnchor.constraintEqualToAnchor(self.topAnchor, constant: 10.0).active = true
self.titleLabel!.bottomAnchor.constraintEqualToAnchor(self.bottomAnchor, constant: -10.0).active = true
self.titleLabel!.leadingAnchor.constraintEqualToAnchor(self.leadingAnchor, constant: 10.0).active = true
self.titleLabel!.trailingAnchor.constraintEqualToAnchor(self.trailingAnchor, constant: -10.0).active = true
}
}