Guest User

Untitled

a guest
Jun 19th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. func addSubviewAndFill(subview: UIView, edgeInsets: UIEdgeInsets = UIEdgeInsets.zero) {
  2. self.addSubview(subview)
  3. subview.translatesAutoresizingMaskIntoConstraints = false
  4. self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "H:|-(\(edgeInsets.left))-[view]-(\(edgeInsets.right))-|", metrics: nil, views: ["view": subview]))
  5. self.addConstraints(NSLayoutConstraint.constraints(withVisualFormat: "V:|-(\(edgeInsets.top))-[view]-(\(edgeInsets.bottom))-|", metrics: nil, views: ["view": subview]))
  6. }
Add Comment
Please, Sign In to add comment