Level Indicator 级别指示器 macos

Rating
Capacity

标本可交互 —— 点点看。Specimen is live — try it.

Anatomy — every part, named解剖 —— 每个部件的名字

  1. 1 Filled level已填充量 NSLevelIndicator.doubleValue

    “The colored amount inside the little meter” is the filled level.

    「小仪表里有颜色的那部分」就是已填充量。

    Prompt fragmentPrompt 片段

    the filled level of an NSLevelIndicator, sized from its doubleValue within the configured range

    NSLevelIndicator 的已填充量,按其 doubleValue 在配置好的范围内确定长度

  2. 2 Warning threshold警告阈值 NSLevelIndicator.warningValue

    “The point where the meter changes to a warning color” is the warning threshold.

    「仪表变成警告颜色的那个点」就是警告阈值。

    Prompt fragmentPrompt 片段

    the NSLevelIndicator.warningValue threshold where the capacity fill changes to its native warning color

    NSLevelIndicator.warningValue 阈值:容量填充在此处变为原生警告色

  3. 3 Critical threshold临界阈值 NSLevelIndicator.criticalValue

    “The point where the bar turns critical” is the critical threshold.

    「条变成临界状态的那个点」就是临界阈值。

    Prompt fragmentPrompt 片段

    the NSLevelIndicator.criticalValue threshold where the capacity fill takes its native critical color

    NSLevelIndicator.criticalValue 阈值:容量填充在此处变为原生临界色

  4. 4 Rating symbol评分符号 NSLevelIndicator.Style.rating

    “Each star in the rating row” is a rating symbol in the level indicator.

    「评分那排里的每颗星星」都是级别指示器里的一个评分符号。

    Prompt fragmentPrompt 片段

    the repeated rating symbols in NSLevelIndicator.Style.rating, filled through the current rating value

    NSLevelIndicator.Style.rating 中重复的评分符号,按当前评分值填充

Prompt — paste into your agentPrompt —— 直接粘贴给你的代理

Use an NSLevelIndicator with the style that matches the meaning: .continuousCapacity or .discreteCapacity for a bounded level, .rating for stars, or .relevancy for match strength. Configure warningValue and criticalValue for native threshold coloring; SwiftUI's nearest general equivalent is Gauge.

使用 NSLevelIndicator,样式要和含义匹配:有上限的量值用 .continuousCapacity 或 .discreteCapacity,星星评分用 .rating,匹配强度用 .relevancy。配置 warningValue 和 criticalValue 获得原生的阈值变色;SwiftUI 最接近的通用等价物是 Gauge。

Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时

Debug my macOS level indicator (NSLevelIndicator). Rule out: the wrong style — continuous capacity vs discrete ticks vs rating stars are one class with different levelIndicatorStyle values; warning and critical thresholds recoloring the fill unexpectedly; isEditable letting clicks change the value when it should be display-only; value changes not animating because the cell redraws instantly. The symptom:

调试我的 macOS 级别指示器(NSLevelIndicator)。排除以下可能:样式用错——连续容量、离散刻度、评分星星是同一个类,只是 levelIndicatorStyle 值不同;警告和临界阈值意外改变了填充颜色;isEditable 让点击能改数值,而它本该只读展示;数值变化没有动画,因为 cell 瞬间重绘。症状是:

In code代码里叫什么

Framework框架Symbol符号Note说明
AppKit NSLevelIndicator
AppKit NSLevelIndicator.Style
SwiftUI Gauge

See also相关词条