Disabling automatic scrolling of UITableView when editing UITextField inside UITableViewCell

后端 未结 9 874
别跟我提以往
别跟我提以往 2020-11-30 00:40

I\'m using custom UITableViewCells inside my UITableView. Each of these UITableViewCells is pretty high and contains a UITextFie

9条回答
  •  失恋的感觉
    2020-11-30 01:01

    The best way is to subclass UITableView and then override setContentOffset(_ contentOffset: CGPoint, animated: Bool) and not to call super.setContentOffset(_ contentOffset: CGPoint, animated: Bool). In this method is where the view controller is doing the automatic scroll.

    override func setContentOffset(_ contentOffset: CGPoint, animated: Bool)
    {
        //Do nothing
    }
    

提交回复
热议问题