TSGennertatorSelectStyleVC.swift 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //
  2. // TSGennertatorSelectStyleVC.swift
  3. // AIEmoji
  4. //
  5. // Created by 100Years on 2025/4/27.
  6. //
  7. class TSGennertatorSelectStyleVC: TSBaseVC {
  8. var viewModel: TSGennertatorSelectStyleViewModel = .init()
  9. lazy var bottomView: UIView = {
  10. let bottomView = UIView()
  11. bottomView.backgroundColor = .popupColor
  12. return bottomView
  13. }()
  14. lazy var xBtn: TSUIExpandedTouchButton = {
  15. let xBtn = TSUIExpandedTouchButton()
  16. xBtn.setUpButton(image: UIImage(named: "close_gray")) { [weak self] in
  17. guard let self = self else { return }
  18. self.dismiss(animated: true)
  19. }
  20. return xBtn
  21. }()
  22. var selectedValueBlock: ((IndexPath, TSGenerateOnlineStyleModel) -> Void)?
  23. lazy var styleCollectionVc: TSGennertatorSelectStyleListVc = {
  24. let vc = TSGennertatorSelectStyleListVc()
  25. vc.viewModel.currentIndexPath = viewModel.currentIndexPath
  26. vc.viewModel.layout = viewModel.layout
  27. vc.viewModel.datas = viewModel.initData
  28. vc.viewModel.isBigLoading = false
  29. vc.selectedValueBlock = selectedValueBlock
  30. vc.view.backgroundColor = .clear
  31. return vc
  32. }()
  33. override func createView() {
  34. view.backgroundColor = .clear
  35. contentView.backgroundColor = .clear
  36. setNavBarViewHidden(true)
  37. contentView.addSubview(bottomView)
  38. bottomView.snp.makeConstraints { make in
  39. make.bottom.leading.trailing.bottom.equalTo(0)
  40. make.top.equalTo(104 + k_Nav_Height)
  41. }
  42. let topView = UIView()
  43. contentView.addSubview(topView)
  44. topView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(clickTopView)))
  45. topView.snp.makeConstraints { make in
  46. make.top.leading.trailing.equalTo(0)
  47. make.bottom.equalTo(bottomView.snp.top)
  48. }
  49. setContentView()
  50. kDelayMainShort {
  51. self.bottomView.cornersRound(radius: 20, corner: [.topLeft, .topRight])
  52. }
  53. }
  54. func setContentView() {
  55. let titleLabel = UILabel.createLabel(text: "Select Style".localized, font: .font(size: 16, weight: .medium), textColor: .white)
  56. bottomView.addSubview(titleLabel)
  57. titleLabel.snp.makeConstraints { make in
  58. make.leading.equalTo(16)
  59. make.top.equalTo(24)
  60. }
  61. bottomView.addSubview(xBtn)
  62. xBtn.snp.makeConstraints { make in
  63. make.top.equalTo(8)
  64. make.trailing.equalTo(-8)
  65. make.width.height.equalTo(24)
  66. }
  67. bottomView.addSubview(styleCollectionVc.view)
  68. styleCollectionVc.view.snp.makeConstraints { make in
  69. make.top.equalTo(56)
  70. make.leading.trailing.equalTo(0)
  71. make.bottom.equalTo(0)
  72. }
  73. addChild(styleCollectionVc)
  74. styleCollectionVc.didMove(toParent: self)
  75. }
  76. override func dealThings() {
  77. addPullDownClosePage()
  78. }
  79. @objc func clickTopView(){
  80. self.dismiss()
  81. }
  82. }