코드로 오토레이아웃 함수 모아 놓기

오토레이아웃 잡을때

class ViewController: UIViewController {
    
    let emailTextFieldView = UIView()
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        makeUI
         
    }

    func makeUI() {
        emailTextFieldView.backgroundColor = .darkGray
        
        view.addSubview(emailTextFieldView)
        
        emailTextFieldView.translatesAutoresizingMaskIntoConstraints = false
        
        emailTextFieldView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 30).isActive = true
        emailTextFieldView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -30).isActive = true
        emailTextFieldView.topAnchor.constraint(equalTo: view.topAnchor, constant: 200).isActive = true
        emailTextFieldView.heightAnchor.constraint(equalToConstant: 40).isActive = true
        
    }

 

텍스트필드 뷰 테두리 둥글게 하는 법

emailTextFieldView.layer.cornerRadius = 5
emailTextFieldView.layer.masksToBounds = true

 

보더 레이어 설정

button.layer.borderWidth = 1
button.layer.borderColor = #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1)