Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var boolName: Bool = false
- override func viewDidLoad() {
- super.viewDidLoad()
- }
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(true)
- if boolName == true
- {
- self.designTextField()
- self.view.layoutIfNeeded()
- }
- }
- override func viewDidLayoutSubviews() {
- super.viewDidLayoutSubviews()
- if boolName == false
- {
- self.designTextField()
- boolName = true
- }
- self.view.layoutIfNeeded()
- }
- func designTextField()
- {
- //Set the horizontal line in bottom of text field
- nameLayer.frame = CGRect(x: 0, y: self.tfName.bounds.size.height, width: self.tfName.bounds.size.width, height: 1)
- nameLayer.backgroundColor = UIColor.lightGray.cgColor
- tfName.layer.addSublayer(nameLayer)
- //Set the horizontal line in bottom of text field
- phoneLayer.frame = CGRect(x: 0, y: self.tfPhone.bounds.size.height, width: self.tfPhone.bounds.size.width, height: 1)
- phoneLayer.backgroundColor = UIColor.lightGray.cgColor
- tfPhone.layer.addSublayer(phoneLayer)
- //Set the horizontal line in bottom of text field
- emailLayer.frame = CGRect(x: 0, y: self.tfEmail.bounds.size.height, width: self.tfEmail.bounds.size.width, height: 1)
- emailLayer.backgroundColor = UIColor.lightGray.cgColor
- tfEmail.layer.addSublayer(emailLayer)
- }
Add Comment
Please, Sign In to add comment