Answers for "swift add width/height constraint to view"

0

swift add width/height constraint to view

// Swift3+
let imageView = UIImageView()
imageView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
  imageView.widthAnchor.constraint(equalToConstant: 16),
  imageView.heightAnchor.constraint(equalToConstant: 16),
])
self.addSubview(self.imageView)
Posted by: Guest on February-25-2022

Code answers related to "swift add width/height constraint to view"

Code answers related to "Swift"

Browse Popular Code Answers by Language