AccountRightListCellView.swift 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // AccountRightListCellView.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by User-Tangchao on 2024/10/28.
  6. //
  7. import Cocoa
  8. class AccountRightListCellView: NSTableCellView {
  9. lazy var iconIv: NSImageView = {
  10. let view = NSImageView()
  11. return view
  12. }()
  13. lazy var label: NSTextField = {
  14. let view = NSTextField(wrappingLabelWithString: "")
  15. return view
  16. }()
  17. override func draw(_ dirtyRect: NSRect) {
  18. super.draw(dirtyRect)
  19. // Drawing code here.
  20. }
  21. convenience init() {
  22. self.init(frame: .init(x: 0, y: 0, width: 200, height: 34))
  23. initSubviews()
  24. initDefaultValue()
  25. }
  26. override func awakeFromNib() {
  27. super.awakeFromNib()
  28. initSubviews()
  29. initDefaultValue()
  30. }
  31. func initSubviews() {
  32. addSubview(iconIv)
  33. addSubview(label)
  34. iconIv.km_add_left_constraint(constant: 0)
  35. iconIv.km_add_size_constraint(size: .init(width: 20, height: 20))
  36. iconIv.km_add_centerY_constraint()
  37. label.km_add_centerY_constraint()
  38. label.km_add_leading_constraint(equalTo: iconIv, attribute: .trailing, constant: 10)
  39. }
  40. func initDefaultValue() {
  41. }
  42. }