iOS: Disable UITableView animation when keyboard shows up(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 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:iOS:当键盘出现时禁用 UITableView 动画
基础教程推荐
- 新的@SystemApi 注解是什么意思,和@hide 有什么区别 2022-01-01
- 可可/目标C(OSX不是iOS)从子对象访问父对象 2022-01-01
- 在 Android 模拟器中激活网络位置提供程序? 2022-01-01
- - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view 如何工作 2022-01-01
- 在 appComponent dagger 2 中动态添加测试模块? 2022-01-01
- Android:STATE_SELECTED不工作 2022-01-01
- 在 iOS8 中无法获得正确的键盘高度值 2022-01-01
- 如何将多个组件添加到 PickerView? 2022-01-01
- 我的 UIImageView 的任务 2022-01-01
- 突出显示朗读文本(在 iPhone 的故事书类型应用程序中) 2022-01-01
