iOS:当键盘出现时禁用 UITableView 动画 [英] iOS: Disable UITableView animation when keyboard shows up

查看:20
本文介绍了iOS:当键盘出现时禁用 UITableView 动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个人都想在键盘弹出时移动 UITableView,但我正在寻找一种方法来禁用键盘弹出时对光标的自动动画.当键盘弹出并导致 UITableView 滚动到光标(以避免阻止它)时,我遇到了奇怪的抽搐/摇晃/不稳定的滚动行为.

Everyone wants to move the UITableView when the keyboard pops up, but I'm looking for a way to disable the automatic animation to the cursor when the keyboard pops up. I'm experiencing an odd jerking / jolting / erratic scrolling behavior when the keyboard pops up and causes the UITableView to scroll to the cursor (to avoid blocking it).

我的每个 UITableView 单元格中都有一个 UITextView.键盘弹出时我没有提交任何其他动画.

Each of my UITableView cells has a UITextView in it. I don't commit any other animations when the keyboard pops up.

此时,我想完全禁用动画并手动滚动到所需的 CGPoint.

At this point, I would like to disable the animation completely and manually scroll to a desired CGPoint.

谢谢!

推荐答案

自动滚动代码驻留在tableViewController中,所以不能禁用自动滚动.您可以从 UIViewController 子类化并在其中使用 tableView,而不是从 UITableViewController 子类化.如果你愿意使用 UITableViewController 本身,你可以重写 viewWillAppear 并且不要调用 [super viewWillAppear].

The automatic scrolling code resides in tableViewController, so auto-scrolling can't be disabled. Instead of subclassing from UITableViewController you can subclass from UIViewController and use a tableView inside it. If you are willing to use UITableViewController itself, you can override viewWillAppear and don't call [super viewWillAppear].

这篇关于iOS:当键盘出现时禁用 UITableView 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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