[iOS/UI] ํค๋ณด๋ ์์ ๋ฒํผ๋ฌ๊ธฐ(add custom buttons above Keyboard)
์๋ ํ์ธ์ Foma ์ ๋๋ค!!
ํค๋ณด๋ ์ ๋ ฅํ ๋ ํค๋ณด๋๋ฅผ ์ฌ๋ผ์ง๊ฒ ํ๊ฑฐ๋ ํ ๋ ํค๋ณด๋ ์์ done๋ฒํผ์ด๋
์๋๋ฉด ํค๋ณด๋ ์๋์๋ ๋ฒํผ์ ๋ณด๊ฒ ํ๊ธฐ์ํด์ ๋ฒํผ์ด ํค๋ณด๋ ์๋ก ๋ฐ๋ผ์ค๋ ๋ฏํ ๊ฒ์ ๋ณผ ์ ์์์ํ ๋ฐ
๋ฐ๋ก ์ค๋์ ํค๋ณด๋ ์์ ์ด์ ๊ณผ ๋ค์ ๋ฒํผ์ ๋ฃ์ด๋ณผ๊ฑฐ์์!
๋ฐ๋ก ์์ํ ๊ฒ์~
Storyboard
๋จผ์ ์คํ ๋ฆฌ๋ณด๋์ ํ ์คํธํ๋ ํ๋๋ฅผ ๋ง๋ค์ด์ค๋๋ค.

ViewController
์์์ ๋ง๋ค์ด์ค ํ ์คํธํ๋๋ฅผ ์ฐ๊ฒฐํด์ค๋๋ค.

๋ฐ๋ก UIToolbar๋ฅผ ํ๋ ๋ง๋ค์ด์ฃผ๋๋ฐ์.

์ด์ ์ฌ๊ธฐ์ ๋ฃ์ด์ค ๋ฒํผ๋ค์ด ํ์ํ๊ฒ ์ฃ ? ๋ฐ๋ก ์ด์ ๋ฒํผ์ ๋ง๋ค์ด์ค๋๋ค.

๊ทธ๋ฆฌ๊ณ ๋ค์๋ฒํผ๋ ๋๊ฐ์ด ๋ง๋ค์ด์ฃผ์ธ์.

์ด๋ ๊ฒ ๋ฒํผ์ ๋ง๋์ จ์ผ๋ฉด ๋ฐ๋ก ํด๋ฐ์ ๋ฃ์ด์ฃผ๋ฉด ๋๋๋?
์๋ฉ๋๋ค. ํด๋ฐ์ ๋ค์ด๊ฐ ์ ์๋ ์์ดํ ๋ค์ UIBarButtonItem๋ง ๋ค์ด๊ฐ ์ ์์ด์.
๊ทธ๋์ ๋ฐ๋ก UIBarButtonItem์ ์ปค์คํ ๋ทฐ๋ฅผ ๋ง๋ค์ด์ฃผ์ ์ด์ ๋ฒํผ ๋ค์๋ฒํผ์ผ๋ก ์ค์ ํด์ค๋๋ค.

๊ทธ ๋ค์ ํด๋ฐ ์์ดํ ์ ๋ฃ์ด์ฃผ์ธ์.

๊ทธ๋ฆฌ๊ณ ๋ง์ง๋ง์ผ๋ก ๋งจ ์ฒ์ ๋ง๋ค์ด์ฃผ์ ํ ์คํธํ๋์ inputAccessoryView๋ฅผ toolBar๋ก ์ค์ ํด์ฃผ์ธ์.

์ด๋ ๊ฒ ํด์ฃผ์๋ฉด ์๋์ฒ๋ผ ์ด์ ๊ณผ ๋ค์๋ฒํผ์ด ํค๋ณด๋๋ฅผ ์ฌ๋ ธ์ ๋ ๋ณด์ด๊ฒ ๋ฉ๋๋ค!!

๋ณด๋์ค
๋ง์ฝ "Done๋ฒํผ๋ง ๊ตฌํํ๊ณ ์ถ์๋ฐ ๋๋ ์ค๋ฅธ์ชฝ์ ์์นํ๊ฒ ํ๊ณ ์ถ์ด" ๋ฅผ ์ํ์๋ ๊ฒฝ์ฐ
๊ทธ๋ด๋ ํด๋ฐ์ ๋น๊ณต๊ฐ์ ๋ง๋ค์ด์ฃผ์ ์ผ๋ฉ๋๋ค.
๋น๊ณต๊ฐ์ ๋ง๋ค๊ธฐ ์ํด์ UIBarButtonItem์ flexibleSpace๋ฅผ ๋ฃ์ด์ฃผ์๋ฉด ๋ฉ๋๋ค.

์ด๊ฑธ ๋ฃ์ด์ฃผ์๋ฉด ์๋์ ๊ฐ์ด Done๋ฒํผ์ด ์ค๋ฅธ์ชฝ์ ์์นํ๊ฒ ๋ฉ๋๋ค.

Source Code
์ด์ ,๋ค์๋ฒํผ
์ค๋ฅธ์ชฝ์ Done๋ฒํผ