๐Ÿ“ฑ App Development Study/iOS๐ŸŽ

[Udemy iOS & Swift Bootcamp] Button UIControl Event

ibelieveinme 2023. 3. 21. 20:27
728x90

๋ฒ„ํŠผ ๊ธฐ๋Šฅ ๊ตฌํ˜„์‹œ ํ•„์š”ํ•œ Event ํ•จ์ˆ˜๋“ค์„ ์ •๋ฆฌํ•ด๋ณด์ž.

 

[UIControl.Event]

ํ•จ์ˆ˜ ์ฝ”๋“œ ํ•˜๋Š” ์ผ
static var touchDown: UIControl.Event A touch-down event in the control.
ํด๋ฆญํ–ˆ์„ ๋•Œ
static var touchDownRepeat: UIControl.Event A repeated touch-down event in the control; for this event the value of the UITouch tapCount method is greater than one.
๋ฐ˜๋ณตํด๋ฆญํ•  ๋•Œ
static var touchDragInside: UIControl.Event An event where a finger is dragged inside the bounds of the control.
๋ฒ„ํŠผ ์˜์—ญ ์•ˆ์—์„œ ๋“œ๋ž˜๊ทธ ํ•  ๋•Œ
static var touchDragOutside: UIControl.Event An event where a finger is dragged just outside the bounds of the control.
๋ฒ„ํŠผ ์˜์—ญ ๋ฐ–์œผ๋กœ ๋“œ๋ž˜๊ทธํ–ˆ์„ ๋•Œ
static var touchDragEnter: UIControl.Event An event where a finger is dragged into the bounds of the control.
๋ฒ„ํŠผ ์˜์—ญ ์•ˆ์œผ๋กœ ๋“œ๋ž˜๊ทธํ–ˆ์„ ๋•Œ
static var touchDragExit: UIControl.Event An event where a finger is dragged from within a control to outside its bounds.
๋ฒ„ํŠผ ์˜์—ญ ์•ˆ์—์„œ ๋“œ๋ž˜๊ทธ ๋๋‚ฌ์„ ๋•Œ
static var touchUpInside: UIControl.Event A touch-up event in the control where the finger is inside the bounds of the control.
๋ฒ„ํŠผ ํด๋ฆญ ํ›„ ๋—์„ ๋•Œ
static var touchUpOutside: UIControl.Event A touch-up event in the control where the finger is outside the bounds of the control.
๋ฒ„ํŠผ ํด๋ฆญ ํ›„ ๋ฒ„ํŠผ ๋ฐ–์—์„œ ์† ๋—์„ ๋•Œ
static var touchCancel: UIControl.Event A system event canceling the current touches for the control.
๋ฒ„ํŠผ ํด๋ฆญ ์ทจ์†Œํ•  ๋•Œ
static varvalueChanged: UIControl.Event A touch dragging or otherwise manipulating a control, causing it to emit a series of different values.
๋ฒ„ํŠผ ์ด๋ฒคํŠธ ๊ฐ’์ด ๋ณ€๊ฒฝ๋  ๋•Œ

 

์ž์„ธํ•œ ๊ฑด ๊ณต์‹๋ฌธ์„œ ์ฐธ์กฐ-!

https://developer.apple.com/documentation/uikit/uicontrol/event

 

UIControl.Event | Apple Developer Documentation

Constants describing the types of events possible for controls.

developer.apple.com


์š”๊ฑธ ๋ฐ”ํƒ•์œผ๋กœ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•  ๋•Œ๋งˆ๋‹ค ํˆฌ๋ช…๋„ alpha ๊ฐ’์„ 1 -> 0.5 -> 1 ๋กœ ๋ณ€ํ™”์‹œํ‚ค๋Š” ๊ธฐ๋Šฅ์„ ๋งŒ๋“ค์–ด๋ณด์ž.

 

1. ๋ฒ„ํŠผ ์ƒ์„ฑ์‹œ์— Event ๋ชฉ๋ก์—์„œ Touch Up Inside, Touch Down ์„ ์„ ํƒํ•ด์„œ ๊ฐ๊ฐ ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด์ค€๋‹ค.

 

2. ๊ทธ๋Ÿผ ์•„๋ž˜์™€ ๊ฐ™์ด Key์— ํ•จ์ˆ˜ ๋‘๊ฐœ๊ฐ€ ๋‹ฌ๋ฆฐ ๋ชจ์Šต์„ ๋ณผ ์ˆ˜ ์žˆ๋‹ค.

 

3. ๋ˆŒ๋ ธ์„ ๋• alpha = 0.5, ๋—์„ ๋• alpha = 1 ๋กœ ์ฝ”๋“œ ๊ตฌํ˜„ํ•ด์ฃผ๊ธฐ.

 

4. ์™„์„ฑ

 

728x90