Архитектурный шаблон "Мрак в моделях" на нескольких языках и платформах
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
702B

  1. import UIKit
  2. // MARK: - Протоколы
  3. protocol MainSection16Buttons {
  4. }
  5. // MARK: - Реализация
  6. extension Main {
  7. enum Section16Buttons {
  8. static func setupCore(_ core: Main.VC) {
  9. // Создаём 16 кнопок.
  10. for i in 0..<16 {
  11. let btn = UIButton()
  12. core.buttons.append(btn)
  13. btn.tag = i
  14. //????btn.addTarget(self, action: #selector(selectButton), for: .touchUpInside)
  15. core.view.addSubview(btn)
  16. }
  17. // Расставляем их в сетке 4x4.
  18. for btn in core.buttons {
  19. btn.frame = CGRect(x: 0, y: btn.tag * 60, width: 50, height: 50)
  20. btn.backgroundColor = .blue
  21. }
  22. }
  23. }
  24. }