Guest User

Untitled

a guest
Feb 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. var boolName: Bool = false
  2.  
  3. override func viewDidLoad() {
  4. super.viewDidLoad()
  5.  
  6. }
  7.  
  8. override func viewWillAppear(_ animated: Bool) {
  9. super.viewWillAppear(true)
  10.  
  11. if boolName == true
  12. {
  13. self.designTextField()
  14. self.view.layoutIfNeeded()
  15. }
  16. }
  17.  
  18.  
  19.  
  20. override func viewDidLayoutSubviews() {
  21. super.viewDidLayoutSubviews()
  22.  
  23.  
  24. if boolName == false
  25. {
  26.  
  27. self.designTextField()
  28. boolName = true
  29. }
  30.  
  31. self.view.layoutIfNeeded()
  32. }
  33.  
  34. func designTextField()
  35. {
  36. //Set the horizontal line in bottom of text field
  37. nameLayer.frame = CGRect(x: 0, y: self.tfName.bounds.size.height, width: self.tfName.bounds.size.width, height: 1)
  38. nameLayer.backgroundColor = UIColor.lightGray.cgColor
  39. tfName.layer.addSublayer(nameLayer)
  40.  
  41. //Set the horizontal line in bottom of text field
  42. phoneLayer.frame = CGRect(x: 0, y: self.tfPhone.bounds.size.height, width: self.tfPhone.bounds.size.width, height: 1)
  43. phoneLayer.backgroundColor = UIColor.lightGray.cgColor
  44. tfPhone.layer.addSublayer(phoneLayer)
  45.  
  46. //Set the horizontal line in bottom of text field
  47. emailLayer.frame = CGRect(x: 0, y: self.tfEmail.bounds.size.height, width: self.tfEmail.bounds.size.width, height: 1)
  48. emailLayer.backgroundColor = UIColor.lightGray.cgColor
  49. tfEmail.layer.addSublayer(emailLayer)
  50. }
Add Comment
Please, Sign In to add comment