Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift: keyboard blocking text view [duplicate]

Tags:

ios

swift

iphone

I have a Text View at the bottom of a UIView, so when touch the text view and the keyboard shows up, the keyboard will block the text view. How can I solve this problem? Can I make the whole UIView move up when the keyboard shows up? so that the keyboard will not block anything

like image 245
JSNoob Avatar asked Jan 20 '26 16:01

JSNoob


1 Answers

Can I make the whole UIView move up when the keyboard shows up?

You certainly can. Just shift it up, as I do in this example.

Another way is to put your whole interface into a UIScrollView - not enabled so that the user can scroll it, but so that you can scroll it. When the keyboard appears, you change the content inset and scroll up, and when the keyboard disappears, you reverse that. Here's my example of that approach.

like image 133
matt Avatar answered Jan 23 '26 06:01

matt