【问题标题】:Add shadows on tableviewcell while reordering [closed]在重新排序时在 tableviewcell 上添加阴影 [关闭]
【发布时间】:2018-05-17 02:14:15
【问题描述】:

如何在重新排序时在选中单元格的左右两侧添加相同的阴影效果?

【问题讨论】:

  • 到目前为止你尝试过什么?也许至少有一些代码示例?
  • 您可以在选择时略微减小单元格宽度。

标签: ios swift uitableview


【解决方案1】:

如果您只想要左右阴影,则在顶部和底部插入矩形,以便顶部和底部阴影隐藏在您的视图后面:

CGRect shadowRect = CGRectInset(someView.bounds, 0, 4);  // inset top/bottom
someView.layer.shadowPath = [[UIBezierPath bezierPathWithRect:shadowRect] CGPath];

【讨论】:

    【解决方案2】:

    我还没有找到使用 Tableview 的解决方案。我认为这是表格视图的限制。一种解决方法是使用 collectionView 而不是表视图。

    【讨论】:

      猜你喜欢
      • 2023-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多