Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func addSubviewAndFill(subview: UIView, edgeInsets: UIEdgeInsets = UIEdgeInsets.zero) {
- self.addSubview(subview)
- subview.translatesAutoresizingMaskIntoConstraints = false
- self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-(\(edgeInsets.left))-[view]-(\(edgeInsets.right))-|", metrics: nil, views: ["view": subview]))
- self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-(\(edgeInsets.top))-[view]-(\(edgeInsets.bottom))-|", metrics: nil, views: ["view": subview]))
- }
Add Comment
Please, Sign In to add comment