GuideBubbleView.swift 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. //
  2. // GuideBubbleView.swift
  3. // PhysicalWallPaper
  4. //
  5. // Created by nkl on 2024/12/17.
  6. //
  7. import Foundation
  8. import UIKit
  9. class GuideBubbleView: UIControl {
  10. lazy var titleLabel: UILabel = {
  11. let lab = UILabel()
  12. lab.textColor = .white
  13. lab.font = .systemFont(ofSize: 16)
  14. lab.text = "Find your favorite songs".localized()
  15. return lab
  16. }()
  17. lazy var bgView: UIImageView = .init(image: UIImage.init(named: "ic_bubble_bg"))
  18. lazy var tapArea : UIControl = UIControl()
  19. override init(frame: CGRect) {
  20. super.init(frame: frame)
  21. addChildren()
  22. makeConstraints()
  23. }
  24. func addChildren(){
  25. addSubview(bgView)
  26. bgView.addSubview(titleLabel)
  27. addSubview(tapArea)
  28. }
  29. func makeConstraints(){
  30. bgView.snp.makeConstraints { make in
  31. make.centerX.equalToSuperview()
  32. make.top.equalTo(safeAreaLayoutGuide.snp.top).offset(84)
  33. }
  34. titleLabel.snp.makeConstraints { make in
  35. make.horizontalEdges.equalToSuperview().inset(12)
  36. make.centerY.equalToSuperview()
  37. }
  38. tapArea.snp.makeConstraints { make in
  39. make.top.leading.trailing.equalToSuperview()
  40. make.bottom.equalTo(bgView)
  41. }
  42. }
  43. required init?(coder: NSCoder) {
  44. fatalError("init(coder:) has not been implemented")
  45. }
  46. }