I am new to programming.
@IBOutlet weak var myView: UIView!
var l: CALayer {
return myView.layer
}
override func viewDidLoad() {
super.viewDidLoad()
setUpLayer()
}
func setUpLayer() {
l.contents = UIImage(named: "IMG_3682.jpg")?.CGImage
l.contentsGravity = kCAGravityCenter
}
The image appears way bigger than myView.
I got imges with various sizes and ratios. and I want to fit them into UIView.layer What is the right way to do it?
thanks