UITableView 和 UIView with keyboardWillShow [英] UITableView and UIView with keyboardWillShow

查看:27
本文介绍了UITableView 和 UIView with keyboardWillShow的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个 UITableView 几乎填满了我的整个 UIViewController,我在底部有一个 UIView,其中包含一个按钮和一个文本字段.

I have this UITableView that almost fills my entire UIViewController, and I have a UIView at the bottom that contains a button and a textfield.

当我点击文本框时,我想让 UIView 和 tableview 向上推,这样 UIView 就在键盘的顶部.

When I click the textfield, I want the UIView and tableview to push up, so that the UIView is just on top of the keyboard.

- UIView:  
  - UITextField
  - UIButton

我在这里尝试了多种建议,但似乎没有一个适合我的情况.

I've tried multiple suggestions on on here, but none seem to work in my situation.

推荐答案

一个词:约束.

在这里阅读我的文章:iOS 屏幕键盘的高度

它基本上在屏幕底部有一个约束,每当用户打开屏幕键盘时,它都会改变这个约束的高度.

It basically has a constraint at the bottom of the screen, and whenever the user opens the onscreen keyboard, it changes the height of this constaint.

希望这会有所帮助.

这篇关于UITableView 和 UIView with keyboardWillShow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆