每个人都想在键盘弹出时移动 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 动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何使用 Quartz Core 绘制星星?How to draw stars using Quartz Core?(如何使用 Quartz Core 绘制星星?)
为什么给 addArcWithCenter 一个 0 度的 startAngle 使它Why does giving addArcWithCenter a startAngle of 0 degrees make it start at 90 degrees?(为什么给 addArcWithCenter 一个 0 度的 startAngle 使它从
在与中心点成给定角度的直线相交的 UIView 矩形上Find the CGPoint on a UIView rectangle intersected by a straight line at a given angle from the center point(在与中心点成给定角度的直线相交
哪种方法是估计拍摄物体尺寸的最佳方法?Which is the best way to estimate measure of photographed things?(哪种方法是估计拍摄物体尺寸的最佳方法?)
如何在 Swift 中将 Int 转换为字符How to convert an Int to a Character in Swift(如何在 Swift 中将 Int 转换为字符)
如何在 Swift 中创建十六进制颜色字符串 UIColor 初How to create a hex color string UIColor initializer in Swift?(如何在 Swift 中创建十六进制颜色字符串 UIColor 初始化程序?)