QSLHomeFriendFooterView.swift 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. //
  2. // QSLHomeFriendFooterView.swift
  3. // QuickSearchLocation
  4. //
  5. // Created by Destiny on 2024/11/25.
  6. //
  7. import UIKit
  8. protocol QSLHomeFriendFooterViewDelegate: NSObjectProtocol {
  9. func addButtonAction()
  10. }
  11. class QSLHomeFriendFooterView: UIView {
  12. weak var delegate: QSLHomeFriendFooterViewDelegate?
  13. lazy var bgView: UIView = {
  14. let view = UIView()
  15. view.backgroundColor = .white
  16. view.addRadius(radius: 8.rpx)
  17. return view
  18. }()
  19. lazy var mainImageView: UIImageView = {
  20. let imageView = UIImageView()
  21. imageView.image = UIImage(named: "home_friends_footer_icon")
  22. return imageView
  23. }()
  24. lazy var addButton: UIButton = {
  25. let btn = UIButton()
  26. btn.addRadius(radius: 22.rpx)
  27. btn.gradientBackgroundColor(color1: .hexStringColor(hexString: "#15CBA1"), color2: .hexStringColor(hexString: "#1FE0BA"), width: 280.rpx, height: 44.rpx, direction: .horizontal)
  28. btn.image(UIImage(named: "home_friends_header_add_icon"))
  29. btn.title("查找好友")
  30. btn.mediumFont(15)
  31. btn.textColor(.white)
  32. btn.setImageTitleLayout(.imgLeft, spacing: 0)
  33. btn.addTarget(self, action: #selector(addButtonAction), for: .touchUpInside)
  34. return btn
  35. }()
  36. lazy var noMoreLabel: UILabel = {
  37. let label = UILabel()
  38. label.text("- 没有更多了 -")
  39. label.font(12)
  40. label.textColor = .hexStringColor(hexString: "#A7A7A7")
  41. return label
  42. }()
  43. override init(frame: CGRect) {
  44. super.init(frame: frame)
  45. self.addSubview(bgView)
  46. bgView.snp.makeConstraints { make in
  47. make.left.equalTo(8.rpx)
  48. make.right.equalTo(-8.rpx)
  49. make.height.equalTo(170.rpx)
  50. make.top.equalTo(0)
  51. }
  52. self.addSubview(noMoreLabel)
  53. noMoreLabel.snp.makeConstraints { make in
  54. make.centerX.equalToSuperview()
  55. make.top.equalTo(bgView.snp.bottom).offset(8.rpx)
  56. }
  57. bgView.addSubview(mainImageView)
  58. mainImageView.snp.makeConstraints { make in
  59. make.size.equalTo(CGSize(width: 106.rpx, height: 83.rpx))
  60. make.centerX.equalToSuperview()
  61. make.top.equalTo(11.rpx)
  62. }
  63. bgView.addSubview(addButton)
  64. addButton.snp.makeConstraints { make in
  65. make.size.equalTo(CGSize(width: 280.rpx, height: 44.rpx))
  66. make.centerX.equalToSuperview()
  67. make.top.equalTo(mainImageView.snp.bottom).offset(8.rpx)
  68. }
  69. }
  70. required init?(coder: NSCoder) {
  71. fatalError("init(coder:) has not been implemented")
  72. }
  73. @objc func addButtonAction() {
  74. delegate?.addButtonAction()
  75. }
  76. }