개발/swift

Swift How to manage keyboard with UIScrollView?

lemonade 2020. 10. 29. 10:00
반응형

How to manage keyboard with UIScrollView?

 

 

When UITextView or UITextField in UIScrollView.

You need to adjust UIScrollView when keyboard shows.

Otherwise some ui might behind the keyboard so user can’t see.

You have to modify scrollView bottom inset accordingly.

 

 

Let’s get started!

 

First, make keyboard show/hide event observer.

 

Second, implement show/hide event function.  ContentInset might different for each cases.

 

 

 

Last, register observer on viewDidLoad.

 

 

 

Happy Coding :)

 

반응형
그리드형

'개발 > swift' 카테고리의 다른 글

Swift UICollectionView performBatch  (0) 2020.11.04
Swift mutating function  (0) 2020.11.01
Swift How to save data? Userdefaults  (0) 2020.10.28
Swift How to set build environment?  (0) 2020.10.25
Swift UILabel linke break mode  (0) 2020.10.22