iOS Develop – UI #1: SnapKit Library

Home   »   iOS Develop – UI #1: SnapKit Library

// 2021-05-05
// use Foundation library
// auto layout(constraints of each of views) by programmatically
// AS-IS

let dateLabel = UILabel()
self.titleView.addSubview(dateLabel) // set dateLabel as child view of titleView.

// auto layout
dateLabel.translatesAutoresizingMaskIntoConstraints = false
dateLabel.centerXAnchor.constraint(equalTo: self.titleView.centerXAnchor).isActive = true
dateLabel.centerYAnchor.constraint(equalTo: self.titleView.centerYAnchor).isActive = true
dateLabel.heightAnchor.constraint(equltToConstant: 200)
dateLabel.widthAnchor.constraint(equltToConstant: 200)

Leave a Reply

Your email address will not be published. Required fields are marked *