@IBOutlet var userID: UITextField!



    

    override func viewDidLoad() {

        super.viewDidLoad()


        // Do any additional setup after loading the view.

        

        userID.underlined()


        

    }





extension UITextField {

    

    func underlined(){

        let border = CALayer()

        let width = CGFloat(1.0)

        border.borderColor = UIColor.lightGray.cgColor

        border.frame = CGRect(x: 0, y: self.frame.size.height - width, width:  self.frame.size.width, height: self.frame.size.height)

        border.borderWidth = width

        self.layer.addSublayer(border)

        self.layer.masksToBounds = true

    }

}



블로그 이미지

엘로드넷

,