1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //
- // KMProductCompareDiscountView.swift
- // PDF Reader Pro
- //
- // Created by User-Tangchao on 2025/1/11.
- //
- import Cocoa
- @objcMembers class KMProductCompareDiscountView: NSView {
- private lazy var backgroundIv_: NSImageView = {
- let view = NSImageView()
- return view
- }()
- private lazy var label_: NSTextField = {
- let view = NSTextField(labelWithString: "")
- view.font = .UbuntuMediumFontWithSize(13)
- view.textColor = .white
- return view
- }()
-
- var backgroundIv: NSImageView {
- get {
- return backgroundIv_
- }
- }
- var label: NSTextField {
- get {
- return label_
- }
- }
-
- convenience init() {
- self.init(frame: .init(x: 0, y: 0, width: 80, height: 40))
-
- initSubviews()
- }
-
- override func awakeFromNib() {
- super.awakeFromNib()
-
- initSubviews()
- }
-
- func initSubviews() {
- addSubview(backgroundIv_)
- addSubview(label_)
-
- backgroundIv_.mas_makeConstraints { make in
- make?.center.mas_equalTo()(0)
- make?.width.equalTo()(self)
- }
- label_.mas_makeConstraints { make in
- make?.centerX.mas_equalTo()(0)
- make?.centerY.mas_equalTo()(-2)
- }
- }
-
- override func layout() {
- super.layout()
-
- backgroundIv.image?.size = self.frame.size
- }
- }
|