Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override open func layoutSubviews() {
- super.layoutSubviews()
- let width = self.frame.width
- let height = self.frame.height
- imageView.contentMode = .scaleAspectFit
- imageView.topAnchor.constraint(equalTo: self.topAnchor, constant: 0.03*height).isActive = true
- imageView.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 0.1*width).isActive = true
- imageView.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -0.1*width).isActive = true
- imageView.heightAnchor.constraint(equalTo: self.heightAnchor, multiplier: 0.6).isActive = true
- label.topAnchor.constraint(equalTo: imageView.bottomAnchor, constant: 0.05*height).isActive = true
- label.leftAnchor.constraint(equalTo: self.leftAnchor, constant: 0.1*width).isActive = true
- label.rightAnchor.constraint(equalTo: self.rightAnchor, constant: -0.1*width).isActive = true
- label.bottomAnchor.constraint(equalTo: self.bottomAnchor, constant: -0.03*height).isActive = true
- self.layoutIfNeeded()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement