본문 바로가기
FE 공부/Swift

Swift _ Stepper

by 꼬질꼬질두부 2022. 11. 15.
A control for incrementing or decrementing a value.
음량 버튼으로 소리를 조정하는 것처럼 + - 를 통해 값 증감을 컨트롤


사진 속 친구를 끌어오면 됨

By default, pressing and holding a stepper’s button increments or decrements the stepper’s value repeatedly. The rate of change depends on how long the user continues pressing the control. To turn off this behavior, set the autorepeat property to false.

: 버튼을 누르거나 꾹 누르고 있으면 값이 변함. 오래 누르면 값이 계속 커지거나 작아지는데 이걸 막고 싶으면 autorepeat property를 false로 바꾸면 됨

 

The maximum value must be greater than or equal to the minimum value. If you set a maximum or minimum value that would break this invariant, both values are set to the new value. For example, if the minimum value is 200 and you set a maximum value of 100, then both the minimum and maximum become 200.

: 값의 최댓값은 최솟값 이상이어야 함

 


Stepper 설정

 

var isContinuous: Bool

A Boolean value that determines whether to send value changes during user interaction or after user interaction ends.
: 사용자 상호 작용 중 또는 사용자 상호 작용이 끝난 후 값 변경 사항을 보낼지 여부를 결정하는 부울 값
 

If true, the stepper sends value change events immediately as the value changes during user interaction. If false, the stepper sends a value change event after user interaction ends.

The default value for this property is true.

: 사용자가 값을 변경할 때 바로 값을 변경할 것인지 사용자가 값을 다 변경한 후에 값을 변경할 것인지

 

var autorepeat: Bool

A Boolean value that determines whether to repeatedly change the stepper’s value as the user presses and holds a stepper button.
: 사용자가 스테퍼 버튼을 길게 누를 때 스테퍼 값을 계속 증가시킬지를 결정하는 부울 값
 

var wraps: Bool

A Boolean value that determines whether the stepper can wrap its value to the minimum or maximum value when incrementing and decrementing the value.
: 값을 증가 및 감소시킬 때 스테퍼가 값을 최소값 또는 최대값으로 래핑할 수 있는지 여부를 결정하는 부울 값
 

If true, incrementing beyond maximumValue sets value to minimumValue; likewise, decrementing below minimumValue sets value to maximumValue. If false, the stepper doesn’t increment beyond maximumValue nor does it decrement below minimumValue but rather holds at those values.

The default value for this property is false.

: 예를 들어 stpper의 max 값이 10 인데 그 이상 증가 버튼이 눌릴 경우, wraps 값이 true 이면 최댓값이 최솟값으로 넘어가 최솟값부터 다시 시작 -> 0부터 다시 시작; 반대로 stpper 값이 이미 최솟값 0인데 감소 버튼이 더 눌린다면 최댓값 10으로 넘어가 다시 줄어듦

default 값은 false 임

 

var minimumValue: Double

The lowest possible numeric value for the stepper : 가장 낮은 숫자 값
 

var maximumValue: Double

The highest possible numeric value for the stepper : 가장 높은 숫자 값
 

var stepValue: Double

The step, or increment, value for the stepper : 얼마만큼 증가할지 결정하는 값

 


Stepper 값에 접근

var value: Double

The numeric value of the stepper : Stepper의 수치적 값

 

'FE 공부 > Swift' 카테고리의 다른 글

Swift _ ProgressView  (0) 2022.11.15
Swift _ Activity Indicator View  (0) 2022.11.15
Swift _ Switch button  (0) 2022.11.15
Swift _ Generics  (0) 2022.10.11
Swift _ Protocols  (0) 2022.10.11

댓글