PQStuckPointMaterialHeadView.swift 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //
  2. // PQStuckPointMaterialHeadView.swift
  3. // PQSpeed
  4. //
  5. // Created by SanW on 2021/5/16.
  6. // Copyright © 2021 BytesFlow. All rights reserved.
  7. //
  8. import BFCommonKit
  9. import BFUIKit
  10. import SnapKit
  11. import UIKit
  12. class PQStuckPointMaterialHeadView: UIView {
  13. lazy var iconImageView: UIImageView = {
  14. let iconImageView = UIImageView(image: UIImage.moduleImage(named: "videomk_netMaterial_selected", moduleName: "BFStuckPointKit", isAssets: false))
  15. return iconImageView
  16. }()
  17. lazy var titleLab: UILabel = {
  18. let titleLab = UILabel()
  19. titleLab.font = UIFont.systemFont(ofSize: 14, weight: .semibold)
  20. titleLab.textColor = UIColor.white
  21. let attString = NSMutableAttributedString(string: "选择的视频总时长 ≥20 秒,效果会更佳哦~")
  22. attString.addAttributes([.foregroundColor: UIColor.hexColor(hexadecimal: "#FBCC37")], range: NSRange(location: 10, length: 3))
  23. titleLab.attributedText = attString
  24. return titleLab
  25. }()
  26. lazy var desLab: UILabel = {
  27. let desLab = UILabel()
  28. desLab.font = UIFont.systemFont(ofSize: 14)
  29. desLab.textColor = UIColor.white
  30. desLab.text = "可同时选视频与图片"
  31. return desLab
  32. }()
  33. override init(frame: CGRect) {
  34. super.init(frame: frame)
  35. backgroundColor = UIColor.hexColor(hexadecimal: "#333333")
  36. addSubview(iconImageView)
  37. addSubview(titleLab)
  38. addSubview(desLab)
  39. }
  40. required init?(coder _: NSCoder) {
  41. fatalError("init(coder:) has not been implemented")
  42. }
  43. override func layoutSubviews() {
  44. super.layoutSubviews()
  45. iconImageView.snp.makeConstraints { make in
  46. make.width.height.equalTo(40)
  47. make.left.equalToSuperview().offset(cDefaultMargin * 2)
  48. make.centerY.equalToSuperview()
  49. }
  50. titleLab.snp.makeConstraints { make in
  51. make.left.equalTo(iconImageView.snp.right).offset(cDefaultMargin)
  52. make.right.equalToSuperview().offset(-cDefaultMargin)
  53. make.top.equalTo(iconImageView)
  54. }
  55. desLab.snp.makeConstraints { make in
  56. make.left.right.equalTo(titleLab)
  57. make.bottom.equalTo(iconImageView)
  58. }
  59. addCorner(roundingCorners: [.topLeft, .topRight], corner: 6)
  60. }
  61. }