// 닫기버튼 우측 상단 배치 예제
let closeButton = UIButton()
closeButton.setImage(UIImage(named: "close"), for: .normal)
closeButton.addTarget(self, action: #selector(closeButton(_:)), for: .touchUpInside)
newWebView.addSubview(closeButton)
        
closeButton.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
	closeButton.topAnchor.constraint(equalTo: newWebView.safeAreaLayoutGuide.topAnchor, constant: 10),
	closeButton.trailingAnchor.constraint(equalTo: newWebView.trailingAnchor, constant: -10),
	closeButton.widthAnchor.constraint(equalToConstant: 50),
	closeButton.heightAnchor.constraint(equalToConstant: 50)
])

+ Recent posts