Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. // superbgImageView - картинка на самом заднем фоне красном
  2. // imageHeader - лента красная
  3. // bgImageView - деревяшка фон которая лежит сразу на superbgImageView
  4. // regButton кнока create
  5.  
  6.  
  7. // frame - указывает координаты левого верхнего края
  8. // если у тебя все привязывается через центр объекта то просто прибавляй/вычитай половину размера из координат
  9.  
  10.  
  11. superbgImageView.frame = self.view.bounds
  12.  
  13. imageHeader.frame = CGRect(x: w/2-w/3, y:h/24, width: 2*w/3, height: h/4)
  14. bgImageView.frame = CGRect(x: w/2-w/3, y: h/8, width: 2*w/3, height: 3*h/4)
  15. regButton.frame = CGRect(x: w/2-w/10, y: 3*h/4, width: w/5, height: h/5)
  16. loginTextField.frame = CGRect(x: w/2-w/8, y: h/4, width: w/4, height: h/8)
  17. passFTextField.frame = CGRect(x: w/2-w/8, y: h/4+h/6, width: w/4, height: h/8)
  18. passSTextField.frame = CGRect(x: w/2-w/8, y: h/4+h/3, width: w/4, height: h/8)
  19. errorMsgLabel.frame = CGRect(x: w/2-w/6, y: 2*h/3 , width: w/3, height: h/8)
  20. loginTextField.font = UIFont(name: "Marker Felt", size: h/16)
  21. passFTextField.font = UIFont(name: "Marker Felt", size: h/16)
  22. passSTextField.font = UIFont(name: "Marker Felt", size: h/16)
  23.  
  24. let label = UILabel(frame: CGRect(x:0, y: -h/16, width: 2*w/3, height: h/4))
  25. label.textAlignment = .center
  26. label.textColor = #colorLiteral(red: 0.9529411793, green: 0.6862745285, blue: 0.1333333403, alpha: 1)
  27. label.text = "REGISTRATION"
  28. label.font = UIFont(name: "Marker Felt", size: h/10)
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35. /// теперь про меню
  36. loginLabel.frame = CGRect(x: 5, y: 5, width: w/6, height: h/8)
  37. loginLabel.font = UIFont(name: "Marker Felt", size: h/20)
  38. exitButton.frame = CGRect(x: w-h/10, y: 5 , width: h/10, height: h/10)
  39. superbgImageView.frame = self.view.bounds
  40.  
  41. bgImageView.frame = CGRect(x: w/2-w/3, y: h/12, width: 2*w/3, height: 5*h/6)
  42. offlineMacthButton.frame = CGRect(x: w/2-w/8, y: h/6, width: w/4, height: h/6)
  43. onlineMacthButton.frame = CGRect(x: w/2-w/8, y: h/3+10, width: w/4, height: h/6)
  44. heroesButton.frame = CGRect(x: w/2-w/8, y: h/2+20, width: w/4, height: h/6)
  45. bookButton.frame = CGRect(x:3*w/4, y: 3*h/4, width: w/4, height: h/4)
  46. runeButton.frame = CGRect(x:0, y: 3*h/4, width: w/4, height: h/4)
  47.  
  48.  
  49. // тут добавляю надписи на кнопки
  50. // добавляю надписи не на саму вью а именно. как наследник кнопки
  51. var buttons = [offlineMacthButton,onlineMacthButton,heroesButton]
  52. var labels = [NSLocalizedString("КАМПАНИЯ", comment: ""),NSLocalizedString("ОНЛАЙН МАТЧ", comment: ""),NSLocalizedString("ГЕРОИ", comment: "")]
  53. for button in buttons {
  54. let label2 = UILabel(frame: CGRect(x:0, y: 0, width: w/4, height: h/6))
  55. label2.textAlignment = .center
  56. label2.textColor = #colorLiteral(red: 0.8039215803, green: 0.8039215803, blue: 0.8039215803, alpha: 1)
  57. label2.text = labels[cnt]
  58. cnt+=1
  59. label2.font = UIFont(name: "Marker Felt", size: h/20)
  60. label2.adjustsFontSizeToFitWidth = true
  61.  
  62. button.addSubview(label2)
  63. }
  64.  
  65. buttons = [bookButton,runeButton]
  66. labels = ["СПЕЛЛБУК","РУНЫ"]
  67. cnt = 0
  68. for button in buttons {
  69. let label2 = UILabel(frame: CGRect(x:0, y: h/13, width: w/4, height: h/4))
  70. label2.textAlignment = .center
  71. label2.textColor = #colorLiteral(red: 0.2094716728, green: 0.1004144028, blue: 0.1077578291, alpha: 1)
  72. label2.text = labels[cnt]
  73. cnt+=1
  74. label2.font = UIFont(name: "Marker Felt", size: h/20)
  75. label2.adjustsFontSizeToFitWidth = true
  76. button.addSubview(label2)
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement