Stepper 步进器 macos

Copies: 2

标本可交互,可以直接操作。

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

  1. 1 Increment button递增按钮 NSStepper.increment

    “The tiny upper arrow that raises the number” is the increment button.

    “上面那个把数字调大的小箭头”就是递增按钮。

    Prompt fragmentPrompt 片段

    the upper increment button of an NSStepper, increasing the bound value by NSStepper.increment

    NSStepper 的上箭头递增按钮,按 NSStepper.increment 的步长增大绑定值

  2. 2 Decrement button递减按钮 NSStepper.increment

    “The tiny lower arrow that reduces the number” is the decrement button.

    “下面那个把数字调小的小箭头”就是递减按钮。

    Prompt fragmentPrompt 片段

    the lower decrement button of an NSStepper, reducing the bound value by NSStepper.increment

    NSStepper 的下箭头递减按钮,按 NSStepper.increment 的步长减小绑定值

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

Place a native Stepper using NSStepper (SwiftUI: Stepper) beside the numeric field, with the compact up/down arrow pair vertically aligned to that field. Bind both controls to the same value and enforce the intended increment, minimum, and maximum.

用 NSStepper(SwiftUI:Stepper)把原生步进器放在数字输入框旁边,紧凑的上下箭头对与输入框垂直对齐。把两个控件绑定到同一个值,并约束好预期的步长、最小值和最大值。

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

Debug my macOS stepper (NSStepper, SwiftUI Stepper). Rule out: the stepper and its text field not bound to the same value so they drift; valueWraps looping from max back to min; autorepeat firing continuously while held when single steps were expected; a number formatter clamping or rejecting the value the stepper just set. The symptom:

调试我的 macOS 步进器(NSStepper、SwiftUI Stepper)。逐一排除:步进器和文本框没有绑定到同一个值,两边各走各的;valueWraps 让数值从最大值绕回最小值;想要单步调节,autorepeat 却在按住时连续触发;数字格式化器把步进器刚设的值截断或拒绝了。症状是:

In code代码里叫什么

Framework框架Symbol符号Note说明
AppKit NSStepper
SwiftUI Stepper
AppKit NSStepper.increment
AppKit NSStepper.minValue
AppKit NSStepper.maxValue

See also相关词条

我的参考集

组合页面参考、知名网站、UI 元素和视觉风格,导出给 AI。

你的下一份设计,从这里开始。

在任意标本旁点击「加入参考」,就能把页面、品牌、组件和风格组合成一份 AI 设计说明。

浏览页面参考

搜索参考库Search the library

输入关键词,搜索所有参考。