1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- //
- // AccountIconView.swift
- // PDF Reader Pro
- //
- // Created by User-Tangchao on 2024/10/28.
- //
- import Cocoa
- class AccountIconView: NSView {
- private lazy var iconIv_: NSImageView = {
- let view = NSImageView()
- view.image = NSImage(named: "KMImageNameAccountLogo")
- return view
- }()
-
- private lazy var label_: NSTextField = {
- let view = NSTextField(labelWithString: NSLocalizedString("AnyRecover", comment: ""))
- view.textColor = KMAppearance.themeColor()
- return view
- }()
-
- private lazy var iv_: NSImageView = {
- let view = NSImageView()
- view.image = NSImage(named: "KMImageNameAccountLogo2")
- return view
- }()
-
- override func draw(_ dirtyRect: NSRect) {
- super.draw(dirtyRect)
- // Drawing code here.
- }
-
- convenience init() {
- self.init(frame: .init(x: 0, y: 0, width: 120, height: 40))
-
- self.initSubviews()
- self.initDefaultValue()
- }
-
- override func awakeFromNib() {
- super.awakeFromNib()
-
- self.initSubviews()
- self.initDefaultValue()
- }
-
- func initSubviews() {
- addSubview(iconIv_)
- addSubview(label_)
- addSubview(iv_)
-
- iconIv_.km_add_left_constraint()
- iconIv_.km_add_size_constraint(size: .init(width: 40, height: 40))
- iconIv_.km_add_centerY_constraint()
- label_.km_add_leading_constraint(equalTo: iconIv_, attribute: .trailing, constant: 10)
- label_.km_add_top_constraint()
- iv_.km_add_leading_constraint(equalTo: iconIv_, attribute: .trailing, constant: 10)
- iv_.km_add_size_constraint(size: .init(width: 71, height: 17))
- iv_.km_add_bottom_constraint()
- }
-
- func initDefaultValue() {}
- }
|