QSLHomeButtonView.swift 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // QSLHomeButtonView.swift
  3. // QuickSearchLocation
  4. //
  5. // Created by mac on 2024/4/11.
  6. //
  7. import UIKit
  8. class QSLHomeButtonView: UIView {
  9. lazy var homeResortBtn: UIButton = {
  10. let _homeResortBtn = UIButton(frame: CGRect(x: 0, y: 0, width: 40, height: 52))
  11. _homeResortBtn.textColor(QSLColor.textColor_333)
  12. _homeResortBtn.font(10)
  13. _homeResortBtn.title("求助")
  14. _homeResortBtn.image(UIImage(named: "home_btn_resort"))
  15. _homeResortBtn.setImageTitleLayout(.imgTop, spacing: 2)
  16. return _homeResortBtn
  17. }()
  18. lazy var homeRefreshBtn: UIButton = {
  19. let _homeRefreshBtn = UIButton(frame: CGRect(x: 0, y: 0, width: 40, height: 52))
  20. _homeRefreshBtn.textColor(QSLColor.textColor_333)
  21. _homeRefreshBtn.font(10)
  22. _homeRefreshBtn.title("刷新")
  23. _homeRefreshBtn.image(UIImage(named: "home_btn_refresh"))
  24. _homeRefreshBtn.setImageTitleLayout(.imgTop, spacing: 2)
  25. return _homeRefreshBtn
  26. }()
  27. override init(frame: CGRect) {
  28. super.init(frame: frame)
  29. addRadius(radius: 6)
  30. effectViewWithAlpha(alpha: 1, size: CGSize(width: 40, height: 104), style: .light)
  31. addSubview(homeResortBtn)
  32. addSubview(homeRefreshBtn)
  33. }
  34. override func layoutSubviews() {
  35. super.layoutSubviews()
  36. homeResortBtn.snp.makeConstraints { make in
  37. make.top.left.right.equalTo(0)
  38. make.height.equalTo(52)
  39. }
  40. homeRefreshBtn.snp.makeConstraints { make in
  41. make.bottom.left.right.equalTo(0)
  42. make.height.equalTo(52)
  43. }
  44. }
  45. required init?(coder: NSCoder) {
  46. fatalError("init(coder:) has not been implemented")
  47. }
  48. }