IOS双击单元格导致UITableView中的项目不会滚动 [英] IOS Double click on cell cause item in UITableView won't scroll

查看:14
本文介绍了IOS双击单元格导致UITableView中的项目不会滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 UITableView 在每个单元格中包含 UITextField
当我在单元格中单击 UITextField 时,键盘将显示并覆盖我的单元格.因此,我通过使用将我的单元格移动到顶部.

I have a UITableView that contains UITextField in each cell
When I click UITextField in the cell, the keyboard will show and cover my cell. Therefore, I move my cell to the top by using.

- (void)keyboardWasShown:(NSNotification*)aNotification
{
    CGPoint scrollPoint = CGPointMake(0, self.activeInputView.frame.origin.y);
    [self.tableView setContentOffset:scrollPoint animated:YES];
}

如果我在每个单元格上使用单击,我的应用程序就可以正常工作.
但是,我在每个单元格上使用双击(这意味着我非常快速地点击它 2 次),我的单元格将停止滚动到顶部.

If I use single click on each cell, my application work fine.
However, I use double click on each cell (it mean I tap on it 2 times very quickly), my cell will stop scroll to the top.

推荐答案

在这一行

CGPoint scrollPoint = CGPointMake(0, self.activeInputView.frame.origin.y);

可能是 2 个错误.

首先,您必须确保您捕获的 inputView 是您想​​要的视图.其次,您应该使用适当的方法将获取的点转换为正确的视图.

Firstly, you have to make sure that inputView that you have captured is the view you want. Secondly, you should convert fetched point to correct view using appropriate method.

见参考:https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIView_Class/#//apple_ref/doc/uid/TP40006816-CH3-SW52

进一步调查需要更多背景信息.

For further investigation need more context.

这篇关于IOS双击单元格导致UITableView中的项目不会滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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