tableView中的textView 或者textField 的键盘处理

来源:互联网 发布:mysql需要多大内存 编辑:程序博客网 时间:2024/06/04 18:45

对于tableView 的textView 或者textField 键盘处理



1. 显示键盘的时候 先  [self.tableView setContentInset:e]

2. 然后通过调用scrollToRowAtIndexPath 方法来滑动cell 底部


[UIViewanimateWithDuration:animationDuration/2.0animations:^{

        UIEdgeInsets e = UIEdgeInsetsMake(0, 0, heighOfOffY, 0);

        // top, left, bottom, right(逆时针)

        [self.tableViewsetContentInset:e];//相当于 tableView 底部提高了 一个键盘的高度

    }completion:^(BOOL finished) {

        if (self.currentIndex >=0) {

            [self.tableViewscrollToRowAtIndexPath:[NSIndexPathindexPathForRow:self.currentIndexinSection:0]atScrollPosition:UITableViewScrollPositionBottomanimated:YES];

        }

    }];


0 0
原创粉丝点击