我一直在尝试使用 Apple 的新 API 来启用自定义 UIView 上的拖动交互。我在使用 iPad 进行测试时成功地使其工作,但是当我在 iPhone 7 - ios 11 beta 3 中运行相同的应用程序时,我无法拖动我的自定义 UIView。
我注意到在 UICollectionView 和 UITableViews 中使用时我们需要启用拖动交互
collectionView.dragInteractionEnabled = true
tableView.dragInteractionEnabled = true
但我无法在文档或任何地方找到有关在自定义 UIView 中启用它以使其在 iPhone 上运行的任何内容。有谁知道如何为 iPhone 的自定义 UIView 启用拖动交互?
Thanks
let dragInteraction: UIDragInteraction = ...
dragInteraction.isEnabled = true
view.addInteraction(dragInteraction)
看一下这个
UIDragInteraction.isEnabledByDefaulthttps://developer.apple.com/documentation/uikit/uidraginteraction/2891051-isenabledbydefault https://developer.apple.com/documentation/uikit/uidraginteraction/2891051-isenabledbydefault
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)