Haptic์ ๋ฃ๊ณ ์ถ๋ค
์ฌ์ฉ์๊ฐ ๋ฒํผ์ ๋๋ ์๋ ๋๋ ๋ค๋๊ฒ ์ธ์ง๋๋๋ก ํ๋ ๋ฐฉ๋ฒ ์ค ํ๋๋ก ํ ํฑ Haptic์ด ์์ด๋๋ค
์ด๋ป๊ฒ ์ฌ์ฉํ๋์ง ์ ๋ฆฌํด๋ณด๋ ค ํฉ๋๋ค.
๋จผ์ Haptic์ ์ฌ์ฉํ๊ธฐ ์ํด AVFoundation์ด๋ผ๋ ํ๋ ์์ํฌ๋ฅผ ์ฌ์ฉํ ๊ฒ๋๋ค.
๐ AVFoundation
iOS, tvOS, macOS๋ฅผ ์ํ ๋ฏธ๋์ด ํ๋ ์์ํฌ
์ด ํ๋ ์์ํฌ๋ฅผ ํตํด ๋ฏธ๋์ด ์บก์ณ, ํธ์ง ๋ฐ low-level ์ฒ๋ฆฌ ๋ฑ ๋ค์ํ ๋ฏธ๋์ด ์ฒ๋ฆฌ ์์ ์ ์ํํ ์ ์์ต๋๋ค.
์ฃผ๋ก ๋ฏธ๋์ด ์ฌ์ ๊ธฐ๋ฅ์ ๋ง์ด ์ฌ์ฉ๋๋ค๊ณ ํฉ๋๋ค.
๐ ์ํ๋ ํ ํฑ ๋ฃ๊ธฐ
์คํ ๋ฆฌ๋ณด๋๋ฅผ ํตํด ์์ ๋ณด์ด๋ ๊ฒ๊ณผ ๊ฐ์ด UI๋ฅผ ๊ตฌ์ฑํ์ต๋๋ค.
๋ฒํผ์ ๋๋ ์๋ ๊ฐ๊ฐ ๋ค๋ฅธ ํ ํฑ์ ๋๋ ์ ์๋๋ก ํ์ต๋๋ค.
AVFoundation์ import ํด์ค ๋ค,
import AVFoundation
์๋์ฒ๋ผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
@IBAction func touchUpFirstButton(_ sender: UIButton) {
/// ์ฝํ๊ณ ์งง์ ์ง๋
AudioServicesPlaySystemSound(1519)
}
@IBAction func touchUpSecondButton(_ sender: UIButton) {
/// ๋ ์ฝํ๊ณ ์งง์ ์ง๋
AudioServicesPlaySystemSound(1520)
}
@IBAction func touchUpThirdButton(_ sender: UIButton) {
/// nope ๋ ๋ฒ ์ง๋
AudioServicesPlaySystemSound(1521)
}
@IBAction func touchUpFourthButton(_ sender: UIButton) {
/// ์๊ณ ๊ธด ์ง๋
AudioServicesPlaySystemSound(4095)
}
Haptic์ 1519, 1520, 1521, 4095์ ํด๋นํ๊ณ ,
๊ทธ ์ธ์ ์ซ์๋ฅผ ๋ฃ์ผ๋ฉด ๋ญ๊ฐ ๋์ฌ๊น ์ถ์ด์ ํด๋ณด๋ ์๋ ์ ๋๋ก ๋์ค๋ค์ฌ
/// ๋ต๋ํ๋ ์๋ฆฌ
AudioServicesPlaySystemSound(1518)
/// ๋ก. ํ๋ ์๋ฆฌ
AudioServicesPlaySystemSound(1519)
์ด๊ฒ์ ๊ฒ ํด๋ณด๋ฉด์ ์ฐพ๋ ์ฌ๋ฏธ๋ ์๋ ๊ฒ ๊ฐ๋ค์...
'iOS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[iOS] Compositional Layout ๐โโ๏ธ (0) | 2022.09.05 |
---|---|
[iOS] ์ปดํฌ๋ํธ๋ฅผ ์ฝ๋๋ฒ ์ด์ค, ์คํ ๋ฆฌ๋ณด๋์์ ๋๋ค ์ธ ์ ์๋๋ก ํ๋ ๋ฐฉ๋ฒ๐ฏ (1) | 2022.05.30 |
[iOS] RxDataSource ๐ก (0) | 2022.05.17 |
[iOS] Diffable Datasourceโ (0) | 2022.03.18 |
[iOS] Notification Center ๐ก (0) | 2022.03.14 |