“the tiny up and down arrows beside a number field”「数字框旁边那对小上下箭头」
“little control that increases or decreases a value”「能增减数值的小控件」
“stacked arrow buttons next to a numeric input”「数字输入框旁边上下叠着的箭头按钮」
“small plus minus style control for changing a number”「调数字用的那种加减小控件」
“spinner arrows for adjusting a value one step at a time”「一步一步调数值的微调箭头」
Copies:2
标本可交互,可以直接操作。
Anatomy — every part, named解剖 —— 每个部件的名字
1Increment 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 的步长增大绑定值
2Decrement 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.
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:
# Stepper · 步进器
UI reference — https://K3tty5555.github.io/LearnUI_PM/macos/stepper/
**The compact up-and-down arrow pair used to increment or decrement a value**
一对紧凑的上下箭头,用来递增或递减数值
**Also called / 也叫:** stepper control, stepper arrows, numeric stepper, incrementer / 步进控件、步进箭头、数字步进器、增减器
## Anatomy — every part, named / 解剖
1. **Increment button · 递增按钮** (`NSStepper.increment`)
“The tiny upper arrow that raises the number” is the increment button.
“上面那个把数字调大的小箭头”就是递增按钮。
Prompt fragment: the upper increment button of an NSStepper, increasing the bound value by NSStepper.increment
2. **Decrement button · 递减按钮** (`NSStepper.increment`)
“The tiny lower arrow that reduces the number” is the decrement button.
“下面那个把数字调小的小箭头”就是递减按钮。
Prompt fragment: the lower decrement button of an NSStepper, reducing the bound value by NSStepper.increment
## Prompt / 提示词
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 / 调试提示词
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 / 代码里叫什么
- **AppKit** `NSStepper`
- **SwiftUI** `Stepper`
- **AppKit** `NSStepper.increment`
- **AppKit** `NSStepper.minValue`
- **AppKit** `NSStepper.maxValue`