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

[Udemy iOS & Swift Bootcamp] Keyboard ๋‹ค๋ฃจ๊ธฐ

ibelieveinme 2023. 7. 2. 19:12
728x90

์ฑ„ํŒ… ๊ธฐ๋Šฅ ๊ตฌํ˜„ ์ค‘, ํ‚ค๋ณด๋“œ๊ฐ€ ์ž…๋ ฅ์ฐฝ์„ ๊ฐ€๋ฆฌ๋Š” ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

ํ‚ค๋ณด๋“œ๊ฐ€ ์œ„๋กœ ์˜ฌ๋ผ์˜ฌ ๋•Œ, ์ž…๋ ฅ์ฐฝ๋„ ํ•จ๊ป˜ ์˜ฌ๋ผ์™€์•ผ ์‚ฌ์šฉ์ž๊ฐ€ ๋ถˆํŽธํ•˜์ง€ ์•Š์„ ๊ฒƒ์ด๋‹ค.

 

์ด ๋ฌธ์ œ์™€ ๊ด€๋ จ๋œ ์ข‹์€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๊ฐ€ ์žˆ๋‹ค. ๋ฐ”๋กœ IQKeyboardManagerSwift.

 

https://cocoapods.org/pods/IQKeyboardManagerSwift

 

IQKeyboardManagerSwift

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView.

cocoapods.org

 

1. IQKeyboardManagerSwift ์„ค์น˜ํ•˜๊ธฐ

Podfile ์— pod 'IQKeyboardManagerSwift' ๊ตฌ๋ฌธ์„ ์ถ”๊ฐ€ํ•ด์ฃผ๊ณ  ํ„ฐ๋ฏธ๋„์—์„œ pod install ์„ ์ž…๋ ฅํ•ด์ค€๋‹ค.

 

์„ค์น˜ ์™„๋ฃŒ ํ›„ Pods ํด๋”๋ฅผ ๋ณด๋ฉด IQKeyboardManagerSwift ๊ฐ€ ์„ค์น˜๋˜์–ด ์žˆ๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

 

2. IQKeyboardManagerSwift ์‹คํ–‰ํ•˜๊ธฐ

๊ณต์‹ ๋ฌธ์„œ์— ๋‚˜์™€ ์žˆ๋Š”๋Œ€๋กœ AppDelegate ํด๋ž˜์Šค์—์„œ IQKeyboardManagerSwift๋ฅผ import ํ•ด์ฃผ๊ณ  ์‹คํ–‰ํ•ด์ค€๋‹ค. 

๋ณธ ์ฝ”๋“œ์—์„œ ๋”ฑ 2์ค„๋งŒ ์ถ”๊ฐ€ํ•˜๋ฉด ๋—.

 

์‹คํ–‰๋œ ๋ชจ์Šต.

 

3. ๊ธฐํƒ€ ์†์„ฑ ์ ์šฉํ•˜๊ธฐ

Done ๋ฒ„ํŠผ์ด ๋‚˜์˜ค๋Š” ์ค„์„ ์—†์• ๊ณ  ์‹ถ์„ ๋•Œ,

TextField ๊ฐ€ ์•„๋‹Œ ๋‹ค๋ฅธ ๊ณณ์„ ํด๋ฆญํ•˜๋ฉด Keyboard ๋ฅผ ๋‚ด๋ฆฌ๊ณ  ์‹ถ์„ ๋•Œ๋Š” ์œ„ 2์ค„์„ ์ถ”๊ฐ€ํ•˜๋ฉด ๋œ๋‹ค.

 

์ ์šฉ๋œ ๋ชจ์Šต.

 

๋˜ ๋‹ค๋ฅธ ์†์„ฑ๋“ค์€ ์•„๋ž˜ ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•ด์„œ ์ ์šฉํ•ด๋ณด์ž.

https://github.com/hackiftekhar/IQKeyboardManager/wiki/Properties-&-Functions

 

Properties & Functions

Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more. - hackiftek...

github.com

 

728x90