In iOS - When touching a text field in a scroll view the view can not scroll

后端 未结 4 791
轻奢々
轻奢々 2021-01-06 11:40

When trying to scroll a view by touching and dragging on a text field, similarly to how you would scroll around on the edit contacts view on the iPhone, the view will not mo

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-06 12:05

    I think it solution in this situation

    extension UITableView {
    
        override public func touchesShouldCancelInContentView(view: UIView) -> Bool {
            if view is UITextField || view is UITextView {
                return true
            }
            return super.touchesShouldCancelInContentView(view)
        }
    
    }
    

提交回复
热议问题