1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- //
- // KMAdvertisementCollectionHeadView.swift
- // KMAdvertisement
- //
- // Created by lizhe on 2022/11/28.
- //
- #if os(OSX)
- import AppKit
- #elseif os(iOS)
- import UIKit
- #endif
- class KMAdvertisementCollectionHeadView: NSView {
- lazy var titleTextField: NSTextField? = {
- for view in self.subviews {
- if view is NSTextField {
- return view as? NSTextField
- }
- }
- return nil
- }()
-
- var model: KMAdvertisementItem! {
- didSet {
- self.reloadData()
- }
- }
-
- func reloadData() {
- self.isHidden = true
- if model?.name != nil {
- self.titleTextField?.stringValue = KMAdvertisementModelTransition.transitionLanguage(langeuage: (model?.name)!)
- }
- self.isHidden = false
-
- self.titleTextField?.textColor = KMAppearance.Layout.h1Color()
-
- // if model.sectionTitle?.color != nil {
- // self.titleTextField?.textColor = KMAdvertisementModelTransition.transitionColor(color: (model.sectionTitle?.color)!, highlight: false)
- // }
- }
-
- override func draw(_ dirtyRect: NSRect) {
- super.draw(dirtyRect)
- // Drawing code here.
- }
-
- }
|