【问题标题】:Click on collection view cell inside a table view cell in tvos application单击 tvos 应用程序中表格视图单元格内的集合视图单元格
【发布时间】:2018-08-06 16:08:48
【问题描述】:

我在 tvos 应用程序的 tableview 单元内有一个集合视图单元。无法获得水平滚动并单击我的收藏视图单元格。如何在表格视图单元格内的集合视图单元格中单击?我想垂直滚动表格视图作为父视图和水平滚动的集合视图作为子视图。

【问题讨论】:

    标签: swift uitableview uicollectionviewcell tvos


    【解决方案1】:

    在你的UITableViewDelegate 中实现tableView(_:canFocusRowAt:)

    func tableView(_ tableView: UITableView, canFocusRowAt indexPath: IndexPath) -> Bool {
        return false
    }
    

    【讨论】:

      【解决方案2】:

      查看您的UICollectionView 及其子视图的一些属性:userInteractionEnabledisEnabled

      如果您无法到达要操作的元素(例如 UIButton),则需要滚动到该元素。检查UICollectionView 的下一个属性:userInteractionEnabledscrollEnabledbouncesalwaysBounceVertical

      【讨论】:

      • 这 4 个属性已经存在。我只点击表格视图单元格,而不是集合视图单元格。当我尝试滚动时,它会调用 tableview 委托属性,例如选择方法,但不在集合视图单元格或其委托函数中。
      • 尝试在集合视图单元格中设置userInteractionEnabled = false
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多