[英]TableViewController presented modally resists scrolling and is difficult to dismiss
I have a TableViewController with dynamic cells which is presented modally via another tableview controller and it "resists" the drag gesture via which modals can be dismissed.我有一个带有动态单元格的 TableViewController,它通过另一个 tableview 控制器以模态呈现,它“抵抗”拖动手势,通过它可以解除模态。
I have tried activating user interaction for all prototype cells but with no result.我尝试为所有原型单元激活用户交互,但没有结果。
Have tried to test quickly with a mock static table and the drag gesture works as usual.尝试使用模拟静态表进行快速测试,拖动手势照常工作。
Can it be that the dynamic cells interfere with the gesture in some way?会不会是动态单元格以某种方式干扰了手势?
Is there some property which I may have changed in my dynamic tableview controller and which may affect the modal's ability to dismiss easily?是否有一些属性可能在我的动态 tableview 控制器中发生了更改,并且可能会影响模态轻松解除的能力?
I set up my tableview like this我像这样设置我的tableview
self.tableView.separatorStyle = .none
self.tableView.backgroundColor = .systemGray6
self.tableView.alwaysBounceVertical = true
The culprit was found to be this line when I set up my TableViewController
:当我设置TableViewController
时,发现罪魁祸首是这一行:
self.tableView.alwaysBounceVertical = false
Apparently, disabling bouncing for the tableview kind of deactivates the drag gesture for the modal view.显然,禁用 tableview 的弹跳会禁用模态视图的拖动手势。
I set it to true and everything was working, although I think it should be possible to disable bounce and still be able to drag the modal down.我将它设置为 true 并且一切正常,尽管我认为应该可以禁用反弹并且仍然能够向下拖动模态。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.