使用uitextview在uitableview中滚动
问题描述:
我有自定义的uitableviewcell的uitableview。要隐藏键盘用户应向上或向下滚动。我通过实施这种方法达到这个使用uitextview在uitableview中滚动
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
if (_isEnableHide) {
[self resignFirstResponderForVisibleCells];
}
}
但
当小区选择和键盘上,我尝试滚动,但奇怪的行为开始。它在键盘消失并且停止任何滚动后开始滚动。
我想的UITableView下来键盘。
我尝试手动这样做是通过动画像这样
....
tableView.contentInset = UIEdgeInsetsZero;
tableView.scrollIndicatorInsets = UIEdgeInsetsZero;
.....
但滚动的实现代码如下停止后的tableview下来,tableview中的插图均为负KEYBOARHEIGHT。如何将桌面视图和键盘一起向下滚动或在滚动停止后手动取消自动向下移动。
答
我已经解决了这个问题,通过设置self.tableView.scrollEnabled为No并在键盘消失后更改为YES。 但是之后不会发生适当的滚动。 为了解决这个问题我们手动滚动tableView
CGRect rect = self.frame;
if (isDown) {
rect.origin.y +=someDistance;
}else{
rect.origin.y -= someDistance;
}
[tableView scrollRectToVisible:rect animated:YES];