I want to place a image over the uiview. To use for lines for a sketch app. I want the image to be stretch across the entire uiview. The uiview is canvasview. I need to create a var image to place over canvas view.
import UIKit
class ViewController: UIViewController {
var canVasView = UIView()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
setup()
draw()
view.addSubview(editBtn)
view.addSubview(canVasView)
editBtn.translatesAutoresizingMaskIntoConstraints = false
canVasView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate ([
canVasView.trailingAnchor.constraint(equalTo: view.centerXAnchor, constant :175),
canVasView.topAnchor.constraint(equalTo: view.centerYAnchor, constant : 100),
canVasView.widthAnchor.constraint(equalToConstant: 350),
canVasView.heightAnchor.constraint(equalToConstant: 180),
])
}