开发者

Could the view to be pushed up when the keyboard occur?

开发者 https://www.devze.com 2023-04-13 02:30 出处:网络
I have created some textfields at the bottom that required users to entry. Is开发者_如何转开发 there any method that can push up the view automatically when the keyboard occur?See Apple\'s Moving Cont

I have created some textfields at the bottom that required users to entry. Is开发者_如何转开发 there any method that can push up the view automatically when the keyboard occur?


See Apple's Moving Content That Is Located Under the Keyboard, or this implementation based in Calculating Area Covered by Keyboard.

Basically you have to mount your view on a UIScrollView and add a bottom content inset with the same height than the keyboard. Then scroll using setContentOffset:animated:. This is a generic solution that you can reuse.

A more simple but non generic way is, if you have enough space at the bottom of your view without editable controls, you just scroll to a fixed position for each edit box.


use the -contentoffset property of your view.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号