Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Gimp/gimp-data/cursors/   (Gimp Bildeditor Version 3.2.0©)  Datei vom 11.2.2026 mit Größe 714 B image not shown  

Quelle  BadgeCountLabel.swift   Sprache: JAVA

 

import Foundation

final class BadgeCountLabel: UILabel {
    
    override var intrinsicContentSize: CGSize {
        var contentSize = super.intrinsicContentSize
        contentSize.height = 20
        
        if contentSize.width < 20 {
            contentSize.width = 20
        }
        else if contentSize.width > 20 {
            contentSize.width += 10
        }
        
        return contentSize
    }

    // MARK: - Lifecycle
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        configureLabel()
    }
    
    required init?(coder: NSCoder) {
        super.init(coder: coder)
        configureLabel()
    }
    
    convenience init() {
        self.init(frame: .zero)
    }
    
    override func drawText(in rect: CGRect) {
        let insets = UIEdgeInsets.zero
        super.drawText(in: rect.inset(by: insets))
    }
    
    public func updateColors() {
        backgroundColor = .systemRed
        textColor = .white
        highlightedTextColor = .white
    }
    
    private func configureLabel() {
        font = UIFont.systemFont(ofSize: 13)
        updateColors()
        
        numberOfLines = 1
        textAlignment = .center
        translatesAutoresizingMaskIntoConstraints = false
        adjustsFontForContentSizeCategory = false
        
        layer.masksToBounds = true
        layer.cornerCurve = .continuous
        layer.cornerRadius = 10
    }
}

Messung
CHZG
811009592

¤ Dauer der Verarbeitung: 0.7 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland