Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func updateConstraints() {
- logoImage.anchor(self.topAnchor, left: self.leftAnchor, bottom: self.bottomAnchor, right: self.rightAnchor, topConstant: 0, leftConstant: 0, bottomConstant: self.frame.height / 2, rightConstant: 0, widthConstant: 0, heightConstant: 0)
- label.anchor(self.logoImage.bottomAnchor, left: self.leftAnchor, bottom: nil, right: self.rightAnchor, topConstant: 12, leftConstant: 0, bottomConstant: 0, rightConstant: 0, widthConstant: 0, heightConstant: 0)
- super.updateConstraints()
- }
- override func layoutSubviews() {
- print(self.frame.height)
- updateConstraints()
- }
- var imageV = UIImageView()
- override init(frame: CGRect) {
- super.init(frame: frame)
- sharedLayout()
- }
- required init?(coder aDecoder: NSCoder) {
- super.init(coder: aDecoder)
- sharedLayout()
- }
- func sharedLayout() {
- // set constraints here
- self.addSubview(imageV)
- self.imageV.translatesAutoresizingMaskIntoConstraints = false
- self.imageV.leadingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true
- self.imageV.trailingAnchor.constraint(equalTo: self.leadingAnchor).isActive = true
- self.imageV.topAnchor.constraint(equalTo: self.topAnchor).isActive = true
- self.imageV.bottomAnchor.constraint(equalTo: self.bottomAnchor).isActive = true
- }
- }
Add Comment
Please, Sign In to add comment